Hi,
we're currently having an interesting issue with our field-definitions and type-detection.
We have fields in our documents that sometimes contain integers, sometimes some strings.
In the documentation we find some parts regarding object datatypes: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/object.html
Given we have this template defined:
PUT my_index
{
"mappings": {
"my_type": {
"properties": {
"region": {
"type": "keyword"
},
"manager": {
"properties": {
"age": { "type": "integer" },
"name": {
"properties": {
"first": { "type": "text" },
"last": { "type": "text" },
"somefield": { "type": "keyword" }
}
}
}
}
}
}
}
}
The field somefield
is in this case our field with mixed input types.
Would this index-template be valid for documents, that don't have a field somefield
(or name.somefield
)?
So, is the example-template valid for all four example-documents?
Example 1:
PUT my_index/my_type/1
{
"region": "US",
"manager": {
"age": 30,
"name": {
"first": "John",
"last": "Doe"
}
}
}
Example 2:
PUT my_index/my_type/2
{
"region": "US",
"manager": {
"age": 35,
"name": {
"first": "Patty",
"last": "Myers",
"somefield": "Some text..."
}
}
}
Example 3:
PUT my_index/my_type/3
{
"region": "US",
"manager": {
"age": 35,
"name": {
"first": "Patrick",
"last": "McDonald",
"somefield": 42
}
}
}
Example 4:
PUT my_index/my_type/4
{
"region": "US",
"manager": {
"age": 35,
"name": {
"first": "Patrick",
"last": "McDonald",
"somefield": 42,
"somedifferentfield": 42
}
}
}