What is the maximum query length in the request body for the rest API of elasticsearch


(Jingyan) #1

I want to use query DSL to query data against elasticsearch, the request like following:
GET /index_test/_search
{"size":5000,"timeout":"500ms","query":{"range":{"@timestamp":{"from":1530768660540,"to":1530769620540,"include_lower":true,"include_upper":true,"boost":1.0}}},"post_filter":{"bool":{"must":[{"terms":{"testField1":["testvalue1","testvalue2"],"boost":1.0}},{"exists":{"field":"testField2","boost":1.0}},{"terms":{"testId":["ID1","ID2"],"boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},"sort":[{"@timestamp":{"order":"desc"}}]}

For the testId filed, I will using a long items to match . So I need to add a lot of values in the terms.
like this:
{"terms":{"testId":["ID1","ID2","ID3","ID4","ID5".........],"boost":1.0}}

So I want to know how many values I can add for the values of testId.
And so I need to know how long the query length in the request body?


(Christian Dahlqvist) #2

There is no fixed limit. Elasticsearch will accept request bodies up to several MB in size by default. As seem in this thread, large terms queries are likely to get slow as the list of terms grows though. You will need to benchmark to see exactly how many you can handle with acceptable query latencies.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.