URI Searchedit

Specifies search criteria as query parameters in the request URI.

GET twitter/_search?q=user:kimchy


GET /<index>/_search?q=<parameter>


You can use query parameters to define your search criteria directly in the request URI, rather than in the request body. Request URI searches do not support the full Elasticsearch Query DSL, but are handy for testing.

Path parametersedit

(Optional, string) Comma-separated list or wildcard expression of index names used to limit the request.

Query parametersedit

(Optional, boolean) Set to false to fail the request if only partial results are available. Defaults to true, which returns partial results in the event of timeouts or partial failures You can override the default behavior for all requests by setting search.default_allow_partial_results to false in the cluster settings.
(Optional, boolean) If true, wildcard and prefix queries are analyzed. Defaults to false.
(Optional, string) Analyzer to use for the query string.
(Optional, integer) The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.
(Optional, string) The default operator for query string query: AND or OR. Defaults to OR.
(Optional, string) Field to use as default where no field prefix is given in the query string.
(Optional, string) For each hit, include an explanation of how the score was computed.
(Optional, integer) Starting document offset. Defaults to 0.
(Optional, boolean) If true, format-based query failures (such as providing text to a numeric field) will be ignored. Defaults to false.
(Optional, string) Query in the Lucene query string syntax.

(Optional, string) The type of the search operation. Available options:

  • query_then_fetch
  • dfs_query_then_fetch
(Optional, integer) The number of hits to return. Defaults to 10.
(Optional, string) True or false to return the _source field or not, or a list of fields to return.
(Optional, string) A list of fields to exclude from the returned _source field.
(Optional, string) A list of fields to extract and return from the _source field.
(Optional, string) The selective stored fields of the document to return for each hit, comma delimited. Not specifying any value will cause no fields to return.
(Optional, string) Sorting to perform. Can either be in the form of fieldName, or fieldName:asc/fieldName:desc. The fieldName can either be an actual field within the document, or the special _score name to indicate sorting based on scores. There can be several sort parameters (order is important).
(Optional, boolean) When sorting, set to true in order to still track scores and return them as part of each hit.
(Optional, integer) Defaults to 10,000. Set to false in order to disable the tracking of the total number of hits that match the query. It also accepts an integer which in this case represents the number of hits to count accurately. (See the request body documentation for more details).
(Optional, time units) A search timeout, bounding the search request to be executed within the specified time value and bail with the hits accumulated up to that point when expired. Defaults to no timeout.
(Optional, integer) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.


GET twitter/_search?q=user:kimchy

The API returns the following response:

    "timed_out": false,
    "took": 62,
        "total" : 1,
        "successful" : 1,
        "skipped" : 0,
        "failed" : 0
        "total" : {
            "value": 1,
            "relation": "eq"
        "max_score": 1.3862944,
        "hits" : [
                "_index" : "twitter",
                "_type" : "_doc",
                "_id" : "0",
                "_score": 1.3862944,
                "_source" : {
                    "user" : "kimchy",
                    "date" : "2009-11-15T14:12:12",
                    "message" : "trying out Elasticsearch",
                    "likes": 0