This index has around ~4k elements but every counter increment takes minimum 160-300ms. Incrementing the same counter in postgres on same data also with index takes 0.01 ms. I understand that one is written in C and other in Java but both make reindex and elastic is not 10-20x slower it's 1600x times slower.
Incrementing the counter requires reindexing the whole document. In a
system like postgresql that just involves copying the row, probably to the
same block. Usually you don't even need to mess with indexes. Elasticsearch
doesn't work like that. It has to reanalyze all the fields and eventually
build a new segment, inverted index, doc values, and all.
Relational databases make tradeoffs to make updates faster. Elasticsearch
makes tradeoffs to make aggregations and full text search faster. Those
tradeoffs are baked in at a fairly deep level.
That said 160ms is quite a bit. You have lots of fields in that document?
Network between the shards slowish? I dunno, hard to say.
Hi Nik,
Thx for replying. I don't have a lof of fields i think around 35. It's not network, it's on one server and i am doing local requests, time is spent inside elasticsearch. Any way to check why it's so slow?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.