Hello,
I got an index with a field mapped as :
"concatGuid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
},
"analyzer": "ConcatKpiAnalyzer",
"fielddata": true
},
the analyzer is an analyzer with the build in : path_hierarchy tokenizer.
I got 3 cluster all on Elastic 6.1.1 :
- DEV : 2 nodes of 20gb of ram/4Cpu
- Homol : 3 nodes 20gb of ram/8cpu
- Prod : 7 nodes of 20gb of ram/8 cpu.
On all the cluster this index is getting data from logstash with a monthly pattern.
IndexName-%{YYYYMM}, it got 5 shard, 1 replica.
On the dev cluster I got an indice of ~500mb total all the request, search + aggregation execute with a time of approximate ~150ms.
On the Homologation cluster I got :
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open profiler-2018.08 WPbBOvaiRDG21VUDoZoIaA 5 1 44034960 0 43.3gb 21.2gb
The search alone take between 6 to 45 ms while with the aggregation it took 24 secondes...
Here the begining of the result :
{
"took": 24254,
"timed_out": false,
"_shards": {
"total": 40,
"successful": 40,
"skipped": 0,
"failed": 0,
"failures": []
},
"hits": {
"total": 1179116,
"max_score": 0,
"hits": []
},
"aggregations": {
"guid": {
"doc_count_error_upper_bound": 1105,
"sum_other_doc_count": 236336,
"buckets": [
{
"key": "d7e69409-5aec-4e8e-ab02-b311782320b7",
"doc_count": 279720,
"status": {
My request look like this :
GET profiler-*/_search
{
"query": {
"term": {
"runGuid": "b80c2146-2bc2-41fc-bac2-141baef82522"
}
},
"size": 0,
"aggs" : {
"guid" : {
"terms" : { "field" : "concatGuid"
,"include": ".*"
,"exclude": ".*\\/.*"
},
"aggs" : {
"status" : {
"terms" : { "field" : "status"
}
}
}
}
}
}
Here the cluster "health"
{
"cluster_name": "liqor-sfy",
"status": "green",
"timed_out": false,
"number_of_nodes": 3,
"number_of_data_nodes": 3,
"active_primary_shards": 429,
"active_shards": 859,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 100
}
How should I optimize my request ?
- Should I add more node to the cluster ?
- Merge the index so we got less than 5 shard ?
- Roll the index weekly instead of monthly for lesser data volume ?
- Is there another way to write this request so we don't use the fieldData true ?