-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Default FieldType.Auto on Arrays of Objects #1803
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
Comments
That's exactly the behaviour for Does that answer your question? |
That's based on the mapping rules defined by Elasticsearch. We should add some documentation that auto does not create a mapping entry but lets Elasticsearch do that. |
I'm not sure if this is by design or not, so appologies if it is.
If an array of Objects is not annotated with FieldType.Object the created mapping will ignore the FieldType annotations on the fields within that Object definition.
Here is some sample code that shows this.
Within the TestRecord there are 3 fields
During execution at // State 1 the created mapping looks like this
Everything is ok, sub_array_1 and the fields are correctly defined as keywords where required. sub_array_2 is not defined in the mapping (maybe because of the default FieldType.Auto?)
Then at // State 2 we've added our first record. The mapping now looks like this
You can see within sub_array_2 the fields sub_keyword and sub_string are both created with a text field and a keyword field as if they were defined as a MultiField
Is this the correct result? Which I think then means that all arrays of Objects must be annoted with a FieldType.Object to make the mapping creation correctly observe the annotations on any child fields.
I wasn't sure if this is as designed or not. We've now annotated all our Lists and arrays with FieldType.Object and recreated the index once we realised this.
The text was updated successfully, but these errors were encountered: