Improving query performance
This section highlights common reasons behind certain slow queries on Elasticsearch, and offers instruction to improve performance.
High-cardinality fields
As previously mentioned, running aggregation or sorts against high-cardinality fields (for example, dates precise to the millisecond) can fill up the fielddata cache which leads to OutOfMemoryError
exceptions. However, even without these errors, running aggregations and sorts can be detrimental to performance. When it comes to dates, it's generally a good idea to store and use less precise dates in order to speed up query execution time.
Querying smaller indices
As Elasticsearch indices grow larger, query performance will suffer. Another way to improve performance is to run queries against small indices. You can do this by storing our data in several smaller indices instead of one large one.
For example, with Twitter data, you can change the ingestion process to create a new index every day to store tweets. This...