Path parameters

  • indexstring | array[string] Required

    A comma-separated list of data streams, indices, and aliases to search. It supports wildcards (*). To search all data streams and indices, omit this parameter or use * or _all.

Query parameters

  • If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.

  • If true and there are shard request timeouts or shard failures, the request returns partial results. If false, it returns an error with no partial results.

    To override the default behavior, you can set the search.default_allow_partial_results cluster setting to false.

  • analyzerstring

    The analyzer to use for the query string. This parameter can be used only when the q query string parameter is specified.

  • If true, wildcard and prefix queries are analyzed. This parameter can be used only when the q query string parameter is specified.

  • The number of shard results that should be reduced at once on the coordinating node. If the potential number of shards in the request can be large, this value should be used as a protection mechanism to reduce the memory overhead per search request.

  • If true, network round-trips between the coordinating node and the remote clusters are minimized when running cross-cluster search (CCS) requests.

  • The default operator for the query string query: AND or OR. This parameter can be used only when the q query string parameter is specified.

    Values are and, AND, or, or OR.

  • dfstring

    The field to use as a default when no field prefix is given in the query string. This parameter can be used only when the q query string parameter is specified.

  • docvalue_fieldsstring | array[string]

    A comma-separated list of fields to return as the docvalue representation of a field for each hit.

  • expand_wildcardsstring | array[string]

    The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. It supports comma-separated values such as open,hidden.

    Values are all, open, closed, hidden, or none.

  • explainboolean

    If true, the request returns detailed information about score computation as part of a hit.

  • ignore_throttledboolean Deprecated

    If true, concrete, expanded or aliased indices will be ignored when frozen.

  • If false, the request returns an error if it targets a missing or closed index.

  • If true, the response includes the score contribution from any named queries.

    This functionality reruns each named query on every hit in a search response. Typically, this adds a small overhead to a request. However, using computationally expensive named queries on a large number of hits may add significant overhead.

  • lenientboolean

    If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can be used only when the q query string parameter is specified.

  • The number of concurrent shard requests per node that the search runs concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.

  • The nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are:

    • _only_local to run the search only on shards on the local node.
    • _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method.
    • _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs. If suitable shards exist on more than one selected node, use shards on those nodes using the default method. If none of the specified nodes are available, select shards from any available node using the default method.
    • _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs. If not, select shards using the default method.
    • _shards:<shard>,<shard> to run the search only on the specified shards. You can combine this value with other preference values. However, the _shards value must come first. For example: _shards:2,3|_local.
    • <custom-string> (any string that does not start with _) to route searches with the same <custom-string> to the same shards in the same order.
  • A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met:

    • The request targets more than 128 shards.
    • The request targets one or more read-only index.
    • The primary sort of the query targets an indexed field.
  • If true, the caching of search results is enabled for requests where size is 0. It defaults to index level settings.

  • routingstring

    A custom value that is used to route operations to a specific shard.

  • scrollstring

    The period to retain the search context for scrolling. By default, this value cannot exceed 1d (24 hours). You can change this limit by using the search.max_keep_alive cluster-level setting.

    Values are -1 or 0.

  • Indicates how distributed term frequencies are calculated for relevance scoring.

    Values are query_then_fetch or dfs_query_then_fetch.

  • statsarray[string]

    Specific tag of the request for logging and statistical purposes.

  • stored_fieldsstring | array[string]

    A comma-separated list of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the _source parameter defaults to false. You can pass _source: true to return both source fields and stored fields in the search response.

  • The field to use for suggestions.

  • The suggest mode. This parameter can be used only when the suggest_field and suggest_text query string parameters are specified.

    Values are missing, popular, or always.

  • The number of suggestions to return. This parameter can be used only when the suggest_field and suggest_text query string parameters are specified.

  • The source text for which the suggestions should be returned. This parameter can be used only when the suggest_field and suggest_text query string parameters are specified.

  • The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.

    IMPORTANT: Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. If set to 0 (default), the query does not terminate early.

  • timeoutstring

    The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. It defaults to no timeout.

    Values are -1 or 0.

  • track_total_hitsboolean | number

    The number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query.

  • If true, the request calculates and returns document scores, even if the scores are not used for sorting.

  • typed_keysboolean

    If true, aggregation and suggester names are be prefixed by their respective types in the response.

  • Indicates whether hits.total should be rendered as an integer or an object in the rest search response.

  • versionboolean

    If true, the request returns the document version as part of a hit.

  • _sourceboolean | string | array[string]

    The source fields that are returned for matching documents. These fields are returned in the hits._source property of the search response. Valid values are:

    • true to return the entire document source.
    • false to not return the document source.
    • <string> to return the source fields that are specified as a comma-separated list that supports wildcard (*) patterns.
  • _source_excludesstring | array[string]

    A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. If the _source parameter is false, this parameter is ignored.

  • _source_includesstring | array[string]

    A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. If the _source parameter is false, this parameter is ignored.

  • If true, the request returns the sequence number and primary term of the last modification of each hit.

  • qstring

    A query in the Lucene query string syntax. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.

    IMPORTANT: This parameter overrides the query parameter in the request body. If both parameters are specified, documents matching the query request body parameter are not returned.

  • sizenumber

    The number of hits to return. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter.

  • fromnumber

    The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter.

  • sortstring | array[string]

    A comma-separated list of <field>:<direction> pairs.

application/json

Body

  • Defines the aggregations that are run as part of the search request.

    External documentation
  • collapseobject
    External documentation
  • explainboolean

    If true, the request returns detailed information about score computation as part of a hit.

  • extobject

    Configuration of search extensions defined by Elasticsearch plugins.

    Hide ext attribute Show ext attribute object
    • *object Additional properties
  • fromnumber

    The starting document offset, which must be non-negative. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter.

  • highlightobject
    Hide highlight attributes Show highlight attributes object
    • typestring

      Any of:

      Values are plain, fvh, or unified.

    • A string that contains each boundary character.

    • How far to scan for boundary characters.

    • Values are chars, sentence, or word.

    • Controls which locale is used to search for sentence and word boundaries. This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP".

    • force_sourceboolean Deprecated
    • Values are simple or span.

    • The size of the highlighted fragment in characters.

    • An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      External documentation
    • If set to a non-negative value, highlighting stops at this defined maximum limit. The rest of the text is not processed, thus not highlighted and no error is returned The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting.

    • The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.

    • The maximum number of fragments to return. If the number of fragments is set to 0, no fragments are returned. Instead, the entire field contents are highlighted and returned. This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required. If number_of_fragments is 0, fragment_size is ignored.

    • optionsobject
      Hide options attribute Show options attribute object
      • *object Additional properties
    • orderstring

      Value is score.

    • Controls the number of matching phrases in a document that are considered. Prevents the fvh highlighter from analyzing too many phrases and consuming too much memory. When using matched_fields, phrase_limit phrases per matched field are considered. Raising the limit increases query time and consumes more memory. Only supported by the fvh highlighter.

    • post_tagsarray[string]

      Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

    • pre_tagsarray[string]

      Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

    • By default, only fields that contains a query match are highlighted. Set to false to highlight all fields.

    • Value is styled.

    • encoderstring

      Values are default or html.

  • track_total_hitsboolean | number

    Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits.

  • indices_boostarray[object]

    Boost the _score of documents from specified indices. The boost value is the factor by which scores are multiplied. A boost value greater than 1.0 increases the score. A boost value between 0 and 1.0 decreases the score.

    External documentation
    Hide indices_boost attribute Show indices_boost attribute object
    • *number Additional properties
  • docvalue_fieldsarray[object]

    An array of wildcard (*) field patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response.

    A reference to a field with formatting instructions on how to return the value

    External documentation
    Hide docvalue_fields attributes Show docvalue_fields attributes object
    • fieldstring Required

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • formatstring

      The format in which the values are returned.

  • knnobject | array[object]

    The approximate kNN search to run.

    One of:
    External documentation
    Hide attributes Show attributes object
    • fieldstring Required

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • query_vectorarray[number]
    • Hide query_vector_builder attribute Show query_vector_builder attribute object
    • knumber

      The final number of nearest neigrs to return as top hits

    • The number of nearest neigr candidates to consider per shard

    • boostnumber

      Boost value to apply to kNN scores

    • filterobject | array[object]

      Filters for the kNN search query

      One of:

      An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      External documentation

      An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

      External documentation
    • The minimum similarity for a vector to be considered a match

    • Hide inner_hits attributes Show inner_hits attributes object
      • namestring
      • sizenumber

        The maximum number of hits to return per inner_hits.

      • fromnumber

        Inner hit starting document offset.

      • collapseobject
        External documentation
      • docvalue_fieldsarray[object]

        A reference to a field with formatting instructions on how to return the value

        Hide docvalue_fields attributes Show docvalue_fields attributes object
        • fieldstring Required

          Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

        • formatstring

          The format in which the values are returned.

      • explainboolean
      • highlightobject
        Hide highlight attributes Show highlight attributes object
        • A string that contains each boundary character.

        • How far to scan for boundary characters.

        • Values are chars, sentence, or word.

        • Controls which locale is used to search for sentence and word boundaries. This parameter takes a form of a language tag, for example: "en-US", "fr-FR", "ja-JP".

        • force_sourceboolean Deprecated
        • Values are simple or span.

        • The size of the highlighted fragment in characters.

        • An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        • If set to a non-negative value, highlighting stops at this defined maximum limit. The rest of the text is not processed, thus not highlighted and no error is returned The max_analyzed_offset query setting does not override the index.highlight.max_analyzed_offset setting, which prevails when it’s set to lower value than the query setting.

        • The amount of text you want to return from the beginning of the field if there are no matching fragments to highlight.

        • The maximum number of fragments to return. If the number of fragments is set to 0, no fragments are returned. Instead, the entire field contents are highlighted and returned. This can be handy when you need to highlight short texts such as a title or address, but fragmentation is not required. If number_of_fragments is 0, fragment_size is ignored.

        • optionsobject
        • orderstring

          Value is score.

        • Controls the number of matching phrases in a document that are considered. Prevents the fvh highlighter from analyzing too many phrases and consuming too much memory. When using matched_fields, phrase_limit phrases per matched field are considered. Raising the limit increases query time and consumes more memory. Only supported by the fvh highlighter.

        • post_tagsarray[string]

          Use in conjunction with pre_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

        • pre_tagsarray[string]

          Use in conjunction with post_tags to define the HTML tags to use for the highlighted text. By default, highlighted text is wrapped in <em> and </em> tags.

        • By default, only fields that contains a query match are highlighted. Set to false to highlight all fields.

        • Value is styled.

        • encoderstring

          Values are default or html.

      • Hide script_fields attribute Show script_fields attribute object
        • *object Additional properties
          Hide * attributes Show * attributes object
      • fieldsarray[string]

        Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

      • sortstring | object | array[string | object]

        One of:

        Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

      • _sourceboolean | object

        Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.

        One of:
      • stored_fieldsstring | array[string]
      • versionboolean
    • Hide rescore_vector attribute Show rescore_vector attribute object
      • oversamplenumber Required

        Applies the specified oversample factor to k on the approximate kNN search

  • rankobject
    Hide rank attribute Show rank attribute object
    • rrfobject
      Hide rrf attributes Show rrf attributes object
      • How much influence documents in individual result sets per query have over the final ranked result set

      • Size of the individual result sets per query

  • min_scorenumber

    The minimum _score for matching documents. Documents with a lower _score are not included in search results and results collected by aggregations.

  • An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

    External documentation
  • profileboolean

    Set to true to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution.

  • queryobject

    An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

    External documentation
  • rescoreobject | array[object]

    Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases.

    One of:
    Hide attributes Show attributes object
    • queryobject
      Hide query attributes Show query attributes object
    • Hide learning_to_rank attributes Show learning_to_rank attributes object
      • model_idstring Required

        The unique identifier of the trained model uploaded to Elasticsearch

      • paramsobject

        Named parameters to be passed to the query templates used for feature

        Hide params attribute Show params attribute object
        • *object Additional properties
  • retrieverobject
    Hide retriever attributes Show retriever attributes object
    • standardobject
      Hide standard attributes Show standard attributes object
    • knnobject
      Hide knn attributes Show knn attributes object
      • filterobject | array[object]

        Query to filter the documents that can match.

        One of:

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation
      • min_scorenumber

        Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.

      • _namestring

        Retriever name.

      • fieldstring Required

        The name of the vector field to search against.

      • query_vectorarray[number]
      • Hide query_vector_builder attribute Show query_vector_builder attribute object
      • knumber Required

        Number of nearest neigrs to return as top hits.

      • num_candidatesnumber Required

        Number of nearest neigr candidates to consider per shard.

      • The minimum similarity required for a document to be considered a match.

      • Hide rescore_vector attribute Show rescore_vector attribute object
        • oversamplenumber Required

          Applies the specified oversample factor to k on the approximate kNN search

    • rrfobject
      Hide rrf attributes Show rrf attributes object
      • filterobject | array[object]

        Query to filter the documents that can match.

        One of:

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation
      • min_scorenumber

        Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.

      • _namestring

        Retriever name.

      • retrieversarray[object] Required

        A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them.

      • This value determines how much influence documents in individual result sets per query have over the final ranked result set.

      • This value determines the size of the individual result sets per query.

    • Hide text_similarity_reranker attributes Show text_similarity_reranker attributes object
      • filterobject | array[object]

        Query to filter the documents that can match.

        One of:

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.

        External documentation
      • min_scorenumber

        Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.

      • _namestring

        Retriever name.

      • retrieverobject Required
      • This value determines how many documents we will consider from the nested retriever.

      • Unique identifier of the inference endpoint created using the inference API.

      • The text snippet used as the basis for similarity comparison

      • fieldstring

        The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text

    • ruleobject
      Hide rule attributes Show rule attributes object
    • rescorerobject
      Hide rescorer attributes Show rescorer attributes object
    • linearobject
      Hide linear attributes Show linear attributes object
    • pinnedobject
      Hide pinned attributes Show pinned attributes object
  • Retrieve a script evaluation (based on different fields) for each hit.

    Hide script_fields attribute Show script_fields attribute object
    • *object Additional properties
      Hide * attributes Show * attributes object
      • scriptobject Required
        Hide script attributes Show script attributes object
        • sourcestring | object

          One of:
        • idstring
        • paramsobject

          Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.

          Hide params attribute Show params attribute object
          • *object Additional properties
        • langstring

          Any of:

          Values are painless, expression, mustache, or java.

        • optionsobject
          Hide options attribute Show options attribute object
          • *string Additional properties
  • search_afterarray[number | string | boolean | null]

    A field value.

  • sizenumber

    The number of hits to return, which must not be negative. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after property.

  • sliceobject
    Hide slice attributes Show slice attributes object
    • fieldstring

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • idstring Required
    • maxnumber Required
  • sortstring | object | array[string | object]

    One of:

    Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    One of:

    Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

  • _sourceboolean | object

    Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.

    One of:
  • fieldsarray[object]

    An array of wildcard (*) field patterns. The request returns values for field names matching these patterns in the hits.fields property of the response.

    A reference to a field with formatting instructions on how to return the value

    Hide fields attributes Show fields attributes object
    • fieldstring Required

      Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

    • formatstring

      The format in which the values are returned.

  • suggestobject
    Hide suggest attribute Show suggest attribute object
    • textstring

      Global suggest text, to avoid repetition when the same text is used in several suggesters

  • The maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting.

    IMPORTANT: Use with caution. Elasticsearch applies this property to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this property for requests that target data streams with backing indices across multiple data tiers.

    If set to 0 (default), the query does not terminate early.

  • timeoutstring

    The period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.

  • If true, calculate and return document scores, even if the scores are not used for sorting.

  • versionboolean

    If true, the request returns the document version as part of a hit.

  • If true, the request returns sequence number and primary term of the last modification of each hit.

    External documentation
  • stored_fieldsstring | array[string]
  • pitobject
    Hide pit attributes Show pit attributes object
    • idstring Required
    • A duration. Units can be nanos, micros, ms (milliseconds), s (seconds), m (minutes), h (hours) and d (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.

  • Hide runtime_mappings attribute Show runtime_mappings attribute object
    • *object Additional properties
      Hide * attributes Show * attributes object
      • fieldsobject

        For type composite

        Hide fields attribute Show fields attribute object
        • *object Additional properties
          Hide * attribute Show * attribute object
          • typestring Required

            Values are boolean, composite, date, double, geo_point, geo_shape, ip, keyword, long, or lookup.

      • fetch_fieldsarray[object]

        For type lookup

        Hide fetch_fields attributes Show fetch_fields attributes object
        • fieldstring Required

          Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

        • formatstring
      • formatstring

        A custom format for date type runtime fields.

      • Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

      • Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

      • scriptobject
        Hide script attributes Show script attributes object
        • sourcestring | object

          One of:
        • idstring
        • paramsobject

          Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time.

          Hide params attribute Show params attribute object
          • *object Additional properties
        • langstring

          Any of:

          Values are painless, expression, mustache, or java.

        • optionsobject
          Hide options attribute Show options attribute object
          • *string Additional properties
      • typestring Required

        Values are boolean, composite, date, double, geo_point, geo_shape, ip, keyword, long, or lookup.

  • statsarray[string]

    The stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • tooknumber Required

      The number of milliseconds it took Elasticsearch to run the request. This value is calculated by measuring the time elapsed between receipt of a request on the coordinating node and the time at which the coordinating node is ready to send the response. It includes:

      • Communication time between the coordinating node and data nodes
      • Time the request spends in the search thread pool, queued for execution
      • Actual run time

      It does not include:

      • Time needed to send the request to Elasticsearch
      • Time needed to serialize the JSON response
      • Time needed to send the response to a client
    • timed_outboolean Required

      If true, the request timed out before completion; returned results may be partial or empty.

    • _shardsobject Required
      Hide _shards attributes Show _shards attributes object
      • failednumber Required
      • successfulnumber Required
      • totalnumber Required
      • failuresarray[object]
        Hide failures attributes Show failures attributes object
        • indexstring
        • nodestring
        • reasonobject Required

          Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

          Hide reason attributes Show reason attributes object
          • typestring Required

            The type of error

          • reasonstring | null

            A human-readable explanation of the error, in English.

          • The server stack trace. Present only if the error_trace=true parameter was sent with the request.

          • caused_byobject

            Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

          • root_causearray[object]

            Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

            Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

          • suppressedarray[object]

            Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

            Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

        • shardnumber Required
        • statusstring
      • skippednumber
    • hitsobject Required
      Hide hits attributes Show hits attributes object
    • _clustersobject
      Hide _clusters attributes Show _clusters attributes object
      • skippednumber Required
      • successfulnumber Required
      • totalnumber Required
      • runningnumber Required
      • partialnumber Required
      • failednumber Required
      • detailsobject
        Hide details attribute Show details attribute object
        • *object Additional properties
          Hide * attributes Show * attributes object
          • statusstring Required

            Values are running, successful, partial, skipped, or failed.

          • indicesstring Required
          • tooknumber

            Time unit for milliseconds

          • timed_outboolean Required
          • _shardsobject
            Hide _shards attributes Show _shards attributes object
          • failuresarray[object]
            Hide failures attributes Show failures attributes object
            • indexstring
            • nodestring
            • reasonobject Required

              Cause and details about a request failure. This class defines the properties common to all error types. Additional details are also provided, that depend on the error type.

            • shardnumber Required
            • statusstring
    • fieldsobject
      Hide fields attribute Show fields attribute object
      • *object Additional properties
    • max_scorenumber
    • profileobject
      Hide profile attribute Show profile attribute object
    • pit_idstring
    • suggestobject
      Hide suggest attribute Show suggest attribute object
GET /{index}/_search
GET /my-index-000001/_search?from=40&size=20
{
  "query": {
    "term": {
      "user.id": "kimchy"
    }
  }
}
resp = client.search(
    index="my-index-000001",
    from="40",
    size="20",
    query={
        "term": {
            "user.id": "kimchy"
        }
    },
)
const response = await client.search({
  index: "my-index-000001",
  from: 40,
  size: 20,
  query: {
    term: {
      "user.id": "kimchy",
    },
  },
});
response = client.search(
  index: "my-index-000001",
  from: "40",
  size: "20",
  body: {
    "query": {
      "term": {
        "user.id": "kimchy"
      }
    }
  }
)
$resp = $client->search([
    "index" => "my-index-000001",
    "from" => "40",
    "size" => "20",
    "body" => [
        "query" => [
            "term" => [
                "user.id" => "kimchy",
            ],
        ],
    ],
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"query":{"term":{"user.id":"kimchy"}}}' "$ELASTICSEARCH_URL/my-index-000001/_search?from=40&size=20"
Run `GET /my-index-000001/_search?from=40&size=20` to run a search.
{
  "query": {
    "term": {
      "user.id": "kimchy"
    }
  }
}
Run `POST /_search` to run a point in time search. The `id` parameter tells Elasticsearch to run the request using contexts from this open point in time. The `keep_alive` parameter tells Elasticsearch how long it should extend the time to live of the point in time.
{
    "size": 100,  
    "query": {
        "match" : {
            "title" : "elasticsearch"
        }
    },
    "pit": {
      "id":  "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA==", 
      "keep_alive": "1m"  
    }
}
When paging through a large number of documents, it can be helpful to split the search into multiple slices to consume them independently. The result from running the first `GET /_search` request returns documents belonging to the first slice (`id: 0`). If you run a second request with `id` set to `1', it returns documents in the second slice. Since the maximum number of slices is set to `2`, the union of the results is equivalent to the results of a point-in-time search without slicing.
{
  "slice": {
    "id": 0,                      
    "max": 2                      
  },
  "query": {
    "match": {
      "message": "foo"
    }
  },
  "pit": {
    "id": "46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=="
  }
}
Response examples (200)
An abbreviated response from `GET /my-index-000001/_search?from=40&size=20` with a simple term query.
{
  "took": 5,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 20,
      "relation": "eq"
    },
    "max_score": 1.3862942,
    "hits": [
      {
        "_index": "my-index-000001",
        "_id": "0",
        "_score": 1.3862942,
        "_source": {
          "@timestamp": "2099-11-15T14:12:12",
          "http": {
            "request": {
              "method": "get"
            },
            "response": {
              "status_code": 200,
              "bytes": 1070000
            },
            "version": "1.1"
          },
          "source": {
            "ip": "127.0.0.1"
          },
          "message": "GET /search HTTP/1.1 200 1070000",
          "user": {
            "id": "kimchy"
          }
        }
      }
    ]
  }
}