Hello,
I recently upgraded my ES cluster from 5.6 to 6.2, along with Kibana, logstash, and filebeat upgrading from 5.6 to 6.2. I had to change my Elasticsearch mapping json file because 6.2 rejected things that 5.6 accepted. Now, data indexed after the upgrade is extremely slow to load into a Kibana table that uses term aggregatations for different keyword fields. If I go back to data that was indexed before the upgrade (still using all the upgraded software), it loads quickly like it used to.
In addition, if I apply the keyword aggregation column as a filter by clicking the + magnifying glass in Kibana, which creates queries of the following type:
{
"query": {
"match": {
"my_text_field_1.keyword": {
"query": "exact_match_for_the_keyword_text",
"type": "phrase"
}
}
}
}
ES now responds, "Cannot search on field [my_text_field_1.keyword] since it is not indexed.".
Again, if I go back to data indexed before the upgrade, this query works.
It seems like the culprit is the mapping change, given that viewing documents indexed before the upgrade works as expected, while stuff indexed with the new mapping works slowly and/or not at all. The aggregations still seem to work, as the table itself uses term aggregations across my_text_field_1, 2 and 3.
Below is the relevant section of the new mapping.
{
"template": "bla-logger-*",
"settings": {
"index": {
"refresh_interval": "10s",
"number_of_replicas": 1,
"number_of_shards": 6
}
},
"mappings" : {
"_default_" : {
"_source" : { "enabled" : false }
},
"doc" : {
"properties" : {
"@timestamp" : { "type" : "date"},
"my_text_field_1" : {
"type": "text",
"fields" : {
"keyword" : { "type" : "keyword", "eager_global_ordinals": true}
}
},
"my_text_field_2" : {
"type": "text",
"fields" : {
"keyword" : { "type" : "keyword", "eager_global_ordinals": true}
}
},
"my_text_field_3" : {
"type": "text",
"fields" : {
"keyword" : { "type" : "keyword", "eager_global_ordinals": true}
}
},
Here is the relevant section of the old mapping, which I know has contradictory/outdated stuff in it, but worked better. Most of the changes made were because ES 6 was complaining about something wrong that ES 5 did not, so I had to figure out how to do it correctly.
"template": bla-logger-*",
"settings": {
"index": {
"refresh_interval": "10s",
"number_of_replicas": 1,
"number_of_shards": 6,
"mapper.dynamic" : false
}
},
"mappings" : {
"_default_" : {
"dynamic_templates": [
{
"strings": {
"match": "*",
"match_mapping_type": "string",
"mapping": { "type": "string", "doc_values": true, "index": "not_analyzed" }
}
},
{
"floats": {
"match": "*",
"match_mapping_type": "floats",
"mapping": { "type": "float", "doc_values": true, "index": "not_analyzed" }
}
}
],
"_all" : { "enabled" : false },
"_source" : { "enabled" : false }
},
"log" : {
"properties" : {
"@timestamp" : { "type" : "date", "doc_values": true },
"my_text_field_1" : {
"type": "string",
"fields" : {
"text" : { "type" : "text", "norms" : false },
"keyword" : { "type" : "keyword", "doc_values": true, "index": "not_analyzed", "eager_global_ordinals": true }
}
},
"my_text_field_2" : {
"type": "string",
"fields" : {
"text" : { "type" : "text", "norms" : false },
"keyword" : { "type" : "keyword", "doc_values": true, "index": "not_analyzed", "eager_global_ordinals": true }
}
},
"fmy_text_field_3" : {
"type": "string",
"fields" : {
"text" : { "type" : "text", "norms" : false },
"keyword" : { "type" : "keyword", "doc_values": true, "index": "not_analyzed", "eager_global_ordinals": true}
}
},
The changes I made were as follows:
- Previously, I had mapper.dynamic set to false but I also specified some dynamic templates, which is nonsensical, and ES 6 told me so whereas ES 5 allowed it. I took out both the dynamic templates and the mapper.dynamic: false line, but ES still appears to be running with mapper.dynamic set to false.
- I took out all the string keywords and replaced them by text/keyword, at the behest of ES 6.
- I removed explicit settings of doc_values as I found that the default behavior in all cases was what I wanted.
- I removed explicit settings of the index keyword as I found that the default behavior in all cases was what I wanted (and ES 6 complained about my use of "not_analyzed".
- I removed the _all enabled: false line as the default behavior is now disabling it.
- Where I had previously used string mappings with fields that were text/keyword, I changed them to text mappings with a keyword field.
None of these changes look like obvious culprits to me... Can anyone see the issue here? Thanks for reading this far and let me know if any additional information would be helpful.