With the query i get a result of 900ms - 1200ms, this is not good enough. i want to improve it and i feel i got stuck.
my SPEC:
3 nodes
8 ram (each node)
4 cpu (each node) - 2.90GHz, capacity: 4230MHz, width: 64 bits
5 shards, 3 replica each shard
ES: 5.2.1
about 7,000,000 docs
mapping:
{ "properties" : { "user_id": { "type": "string", "index": "not_analyzed" }, "date": { "type": "date", "format": "strict_date_optional_time||epoch_millis" }, "tran_value": { "type": "float" }, "type": { "type": "string", "index": "not_analyzed" } }
query:
{ "profile": true, "query": { "bool": { "must": [ { "term": { "doc.type": "transaction" } }, { "range": { "doc.date": { "lt": "2018-10-14T04:51:19.807Z" } } }, { "terms": { "doc.user_id": [ "u::2-1482136850986-166310", "u::2-1476646137089-722440", "u::2-1479194700963-852066", "u::2-1480265460875-343974", "u::2-1481480223561-687220", "u::2-1490893533742-495973", "u::2-1491369718244-637855", "u::2-1516387240762-347825", "u::2-1528653244185-72739", "u::2-1528655615289-795763", "u::2-1529855538547-966658", "u::2-1530351338917-849377", "u::2-1530370314753-233523", "u::2-1530895620180-904769", "u::2-1534446475987-300580", "u::2-1535168457544-236782", "u::2-1537987992702-74474", "u::2-1538136688139-639988", "u::2-1538496245078-5097" ] } } ] } }, "size": 0, "from": 0, "aggs": { "transactionTotalValue": { "sum": { "field": "doc.tran_value" } }, "transactionMinDate": { "min": { "field": "doc.date" } } } }
profile result:
profile_1_shard