Help Center/
MapReduce Service/
Component Operation Guide (LTS) (Ankara Region)/
Using Elasticsearch/
Elasticsearch Performance Tuning/
Data Query and Optimization/
Optimizing Query Statements
Updated on 2024-11-29 GMT+08:00
Optimizing Query Statements
The query statements are optimized in terms of query scope and the number of records to be queried at a time.
- The query scope is planned based on the actual service requirements. The smaller the query range is, the faster the query is. Large query range may cause low query efficiency, sharp increase of the Elasticsearch cluster resource consumption and even breakdown of the cluster. The _source parameter can be used to control the return field information. Do not obtain large fields.
- The maximum number of query requests is limited to ensure that the memory is not much occupied by the query memory. The default query request of the Elasticsearch usually returns the first 10 records after sorting, and a maximum of 10,000 records can be read at a time. The from and size parameters are used to control the range of records to be read. This prevents too many records from being read at a time. To query more than 10,000 records at a time, run the scroll command. For details, see Scroll Query.
The following is an example of query in security mode:
curl -XGET --tlsv1.2 --negotiate -k -u : "https://ip:httpport/myindex-001/_search?pretty" -H 'Content-Type: application/json' -d' { "from": 0, "size": 10, "_source": "age", "query": { "match": { "age": "56" } }, "sort": [ { "age": { "order": "asc" } } ] }'
Parent topic: Data Query and Optimization
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot