Hello community,
I have an elastic search cluster split around 2 nodes (and given 4gb ram to elastic on each). There I have an index containing about 80 million docs. I have split this across 10 shards. There are many aggregations and searches I do, after reading at many I places I converted many long fields to string keyword fields with eager loading of cardinals enabled. After all this my results are still terrible (20-30 seconds) and knowing elastic search this should have been less than a sec. Please help in finding out what I am doing wrong and how can I fix this.
Index settings
"settings": {
"index": {
"refresh_interval": "-1",
"number_of_shards": "10",
"translog": {
"durability": "async"
},
"provided_name": "a",
"creation_date": "1558624380928",
"priority": "100",
"number_of_replicas": "1",
"uuid": "6PyhVEhFTcSNxhqyUE5SaQ",
"version": {
"created": "6030299"
}
}
},
index mapping
https://pastebin.com/rgJvEAvT
query
POST /doc/doc/_search?pretty
{
"profile": "true",
"from": 0,
"size": 20,
"query": {
"bool": {
"must": [
{
"term": {
"a.keyword": "hello"
}
},{
"term": {
"b.keyword": 260464
}
}
]
}
},
"aggs": {
"a": {
"terms": {
"field": "a.keyword"
}
},
"b": {
"terms": {
"field": "b.keyword"
}
},
"c": {
"terms": {
"field": "c.keyword"
}
},
"d": {
"terms": {
"field": "d.keyword"
}
},
"e": {
"terms": {
"field": "d.keyword"
}
},
"f": {
"terms": {
"field": "e.keyword"
}
},
"g": {
"terms": {
"field": "f.keyword"
}
},
"h": {
"terms": {
"field": "g.keyword"
}
},
"_id_count": {
"value_count": {
"field": "_id"
}
}
},
"sort": [
{
"updated_at": {
"order": "desc"
}
}
]
}
profile of one shard
https://pastebin.com/AjJR1Baz