New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multifield path per field #4099
Comments
I attempted to solve this problem a few months ago in #2535. I even started implementing it, but then I stumbled upon an issue that I couldn't quite figure out. In order to be consistent if we support field-level path for multi_field, we also need to support it for objects. And with objects adding field-level path creates an interesting issue. Here is an example that demonstrates this issue. Assuming that we enable "path":"just_name" on the field level, how should we deal with the following mapping:
Here we have object With |
Thank you Igor. Do you see any danger in giving multi_fields "."-separated names to mimic full name? like award.activity.code.na in the example below. I can work around the issue using this approach if use of "." would not pose any future compatibility risks. It works so far but I want to be sure it is not accidental
|
I think your workaround should work, but it's not pretty. I would love to come up with a better solution. Perhaps we can change the
would be indexed as In other words, I think that we've identified the problem, but solution still requires some brain-storming. |
I find the My suggestion is to remove the If you specify an This would allow mappings like:
In this example, you'd have:
What do you think of this proposal? |
Yes! |
Good news! Never liked just_name thing. Good riddance. What would prevent me from putting wrong index name for the primary field or is it always translated to index name via its mapping json key (matching property name)? What if we replace fields with array and get rid of redundant json keys for the fields.
|
@roytmana for 90% of use cases, specifying the field name and the mapping is more understandable than the array with index_name, so I'd keep that as it is. |
@clintongormley Requirement to provide field name matching property name to identify the primary field is error prone and redundant better supply no name at all. Of course not supplying the name would not work with json object structure. May be it was intuitive before you introduced concept of index_name and index_path but not any more. now these attributes are the important ones and field json keys are truly redundant and serve no purpose just making mapping bigger and more confusing with competing naming strategies just my 2c |
I would like to see something we we can do a basic field "copy" without needing all the multi_field stuff unless you need different analyzer settings, etc. Something like:
This would give us: name.first This way we can avoid all the duplicated "full" mappings. |
please also see #4123 particularly my last comment I do not know lucene internals but from ES search API perspective name field is not collapsed into one field across type and category properties and can be searched independently from each other. the quick test shows that what you say is correct and primary field 'name' in my case acts no different than 'all' field in my mapping which i intended to COLLAPSE If ES does not expand primary field name to full path, than the whole concept of multi_field is flawed! All ES examples virtually imply that it is not so I am already using full path name for parts of multifield that I do not want to collapse but I thought the primary fields will be different. I will have to switch to using full path for all field of multifields that i do not intend to collapse - what a pain |
Currently multifield mapping support path parameter per property so if you need to have several fields mapped for a property they will either all have full path name or just_name
it is rather inconvenient when you want to have the property with say two secondary fields one with full name (because it only makes sense as a variant of primary field say not analyzed) and one with just_name because you want to have an all-like field to which many of your properties contribute.
consider an example (a part of a bigger json)
"category": {"code":"CTZ", "description":"My Description"}
code was indexed as multifield resulting in names
category.code
category.code.untouched
later I want to have my_all field to where I want to index category.code as well as other fields
I will add path:"just_name" to my mapping and another field my_all
that will immediately break my application because untouched will become a just_name mapping as well and all untouched from all my data elements will be rolled into it
My current workaround is to provide full name for untouched field (category.code.untouched) so it retains its full name. I am not sure it is intentional behavior but it seems to work (need to test it more)
But much cleaner approach would be to allow path per field in multifield mapping
The text was updated successfully, but these errors were encountered: