1

In our elastic index we have daily news documents and we are running aggregations for these documents. But, after 2 consecutive run elasticsearch returns not enough memory exception. Now we have increased the heap size for elastic but is there any solution other then increasing the ram for elastic?

The field properties which is used for aggregations;

"detail_stop": {
          "type": "string",
          "store": true,
          "analyzer": "stop_analyzer"
        }

The query for aggregation;

 {
        "from": 0,
        "size": 5000,
        "query": {
            "bool": {
                "must": [
                    {
                        "range": {
                            "date": {
                                "gte": "now-0d/d"
                            }
                        }
                    }

                ]
            }
        },
        "aggs": {
            "words": {
                "terms": {
                    "size": 5000,
                    "field": detail_stop,
                    "min_doc_count": 3
                }
            }
        }
    }  

Currently we have an elastic cluster with 1 node(8core 2.5ghz , 32gb) and ES_HEAP_SIZE = 16g(elastic have 16gb memory). How can we reduce usage of memory and increase performance?

1 Answer 1

0

If you are using Field Cache, then you have to provide more memory for aggregations to work. You can try out the tips mentioned here to monitor and limit memory consumption.

With newer versions of Elasticsearch, doc values are becoming the norm instead of field data cache. They are slightly slower compared to field data but will solve the memory problem. Mind you, to use doc values you will have to re-index all your data again. Read more about it here.

Sign up to request clarification or add additional context in comments.

3 Comments

I know that I have to re-index when I use doc_val but doc values do not support analyzed fields so that is not an option. Thanks for the answer.
I've checked the link you mentioned above a dozen times and already made the tunning about heapspace, cpu usage etc. But couldn't get useful result so far. I'm asking for other solutions if exist.
There aren't any. If you are using field cache, you have to make space in the heap memory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.