ES6.3 Common API Search Class API

Source: Internet
Author: User

1. Search Api1.1.routing: Routing

when you perform a search, it broadcasts to all index/index shards (loops between replicas). You can routing control which shards will be searched by providing parameters . For example, when you index a tweet, the route value can be a user name.

 post/twitter/tweet?routing=kimchy{  "  user   ":  kimchy  "    postdate   ": "  2009-11-15t14:12:12   " ,  "   : "  trying out Elasticsearch   "  
1.2.adaptive Replica selection: Adaptive copy Selection

You can enable adaptive copy selection as an alternative to requests that are sent in a circular manner to a copy of the data. This allows the coordination node to send requests to a replica that is considered "best" based on many criteria:

    • The response time of the past request between the coordination node and the node containing the copy of the data
    • The time to exceed the search request is performed on the node that contains the data
    • The queue size of the search thread pool on the node that contains the data

This can be turned on by changing the dynamic cluster configuration cluster.routing.use_adaptive_replica_selection from false to thetrue

PUT/_cluster/ settings{    "ephemeral": {        "cluster.routing.use_adaptive_replica_selection":True     }}
1.3.Stats Groups: Statistics Group

searches can be associated with statistical groups, and statistical groups maintain statistical aggregations for each group. You can use indices stats  api specifically to retrieve it later   . For example, the following is a search body request that associates a request with two different groups:

POST/_search{    "query"  : {        "match_all"  : {}    },    "stats" : ["group1"  "group2"]}

1.4. Global Search Timeout

As part of the request body search, a single search may time out. Because search requests can originate from multiple sources, Elasticsearch has a dynamic cluster-level setting that has a global search timeout for all search requests that do not have a timeout set in the request body search. The default value is no global timeout. search.default_search_timeout You can use the cluster update settings endpoint settings and Settings key. Set this value to reset the -1 global search timeout to no time-out.

1.5. Search Cancel

You can use the standard task cancellation mechanism to cancel the search . By default, a running search checks only if it is canceled on the segment boundary, so cancellation can be delayed by a large segment. by setting The dynamic cluster level setting to, you can improve the responsiveness of search cancellation search.low_level_cancellation true . However, it brings additional overhead for more frequent cancellation checks, which is evident in large, fast-running search queries. Changing this setting affects only the search that starts after the change.

1.6. Search Concurrency and parallelism

By default, Elasticsearch does not reject any search requests based on the number of shards that the request hits. Although Elasticsearch will optimize search execution on the coordination node, a large number of shards can have a significant impact on the CPU and memory. organizing data in such a way is often a better idea, that is, fewer large shards. If you are configuring a soft limit, you can update action.search.shard_count.limit the cluster settings to reject search requests that search for too many shards.

Request Parameters max_concurrent_shard_requests can be used to control the maximum number of concurrent Shard requests that the search API will perform for the request. This parameter should be used to protect a single request from overloading the cluster (for example, the default request will hit all indexes in the cluster, and if the number of shards per node is high, fragmentation requests may be denied). This default value is based on the number of data nodes in the cluster, but up 256 to .

 

ES6.3 Common API Search Class API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.