The purpose of the fleet search api is to provide a search api where the search will only be executed

  • POST also GET /{index}/_fleet/_fleet_search
Auth

after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.

Required authorization

Index privileges read

Path parameters

index union string required

A single target to search. If the target is an index alias, it must resolve to a single index.

Query parameters

allow_no_indices boolean
analyzer string
analyze_wildcard boolean
batched_reduce_size number
ccs_minimize_roundtrips boolean
default_operator enum
Values: and AND or OR
df string
docvalue_fields union string | string[]
expand_wildcards union enum | enum[]

Supported values include:

  • all: Match any data stream or index, including hidden ones.
  • open: Match open, non-hidden indices. Also matches any non-hidden data stream.
  • closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  • hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both.
  • none: Wildcard expressions are not accepted.
Values: all open closed hidden none
explain boolean
ignore_throttled boolean
ignore_unavailable boolean
lenient boolean
max_concurrent_shard_requests number
min_compatible_shard_node string
preference string
pre_filter_shard_size number
request_cache boolean
routing string
scroll string
search_type enum

Supported values include:

  • query_then_fetch: Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.
  • dfs_query_then_fetch: Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.
Values: query_then_fetch dfs_query_then_fetch
stats string[]
stored_fields union string | string[]
suggest_field string

Specifies which field to use for suggestions.

suggest_mode enum

Supported values include:

  • missing: Only generate suggestions for terms that are not in the shard.
  • popular: Only suggest terms that occur in more docs on the shard than the original term.
  • always: Suggest any matching suggestions based on terms in the suggest text.
Values: missing popular always
suggest_size number
suggest_text string

The source text for which the suggestions should be returned.

terminate_after number
timeout string
track_total_hits boolean | number
track_scores boolean
typed_keys boolean
rest_total_hits_as_int boolean
version boolean
_source union oneOf
One of: boolean or string
_source_excludes union string | string[]
_source_includes union string | string[]
seq_no_primary_term boolean
q string
size number
from number
sort union string | string[]
wait_for_checkpoints number[] · default: []

A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search.

allow_partial_search_results boolean

If true, returns partial results if there are shard request timeouts or shard failures. If false, returns an error with no partial results. Defaults to the configured cluster setting search.default_allow_partial_results which is true by default.

Request body

aggregations map string to {} Aggregation
collapse object
field string required

The field to collapse the result set on

inner_hits union oneOf

The number of inner hits and their sort order

object or object[]
name string

The name for the particular inner hit definition in the response. Useful when a search request contains multiple inner hits.

size number · default: 3

The maximum number of hits to return per inner_hits.

from number · default: 0

Inner hit starting document offset.

collapse object
Same fields as collapse
docvalue_fields object[]
field string required

A wildcard pattern. The request returns values for field names matching this pattern.

format string

The format in which the values are returned.

include_unmapped boolean
explain boolean
highlight object
type union anyOf

Supported values include:

  • plain: The plain highlighter uses the standard Lucene highlighter
  • fvh: The fvh highlighter uses the Lucene Fast Vector highlighter.
  • unified: The unified highlighter uses the Lucene Unified Highlighter.
Values: plain fvh unified
boundary_chars string · default: .,!? \t\n

A string that contains each boundary character.

boundary_max_scan number · default: 20

How far to scan for boundary characters.

boundary_scanner enum

Specifies how to break the highlighted fragments: chars, sentence, or word. Only valid for the unified and fvh highlighters. Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter.

Supported values include:

  • chars: Use the characters specified by boundary_chars as highlighting boundaries. The boundary_max_scan setting controls how far to scan for boundary characters. Only valid for the fvh highlighter.
  • sentence: Break highlighted fragments at the next sentence boundary, as determined by Java’s BreakIterator. You can specify the locale to use with boundary_scanner_locale. When used with the unified highlighter, the sentence scanner splits sentences bigger than fragment_size at the first word boundary next to fragment_size. You can set fragment_size to 0 to never split any sentence.
  • word: Break highlighted fragments at the next word boundary, as determined by Java’s BreakIterator. You can specify the locale to use with boundary_scanner_locale.
Values: chars sentence word
boundary_scanner_locale string · default: Locale.ROOT

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_source boolean deprecated
fragmenter enum · default: span

Specifies how text should be broken up in highlight snippets: simple or span. Only valid for the plain highlighter.

Values: simple span
fragment_size number · default: 100

The size of the highlighted fragment in characters.

highlight_filter boolean
highlight_query {} Query

Highlight matches for a query other than the search query. This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.

max_fragment_length number
max_analyzed_offset number

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.

no_match_size number · default: 0

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

number_of_fragments number · default: 5

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.

options map string to object
order enum · default: none

Sorts highlighted fragments by score when set to score. By default, fragments will be output in the order they appear in the field (order: none). Setting this option to score will output the most relevant fragments first. Each highlighter applies its own logic to compute relevancy scores.

Values: score
phrase_limit number · default: 256

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_tags 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_tags 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.

require_field_match boolean · default: true

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

tags_schema enum

Set to styled to use the built-in tag schema.

Values: styled
encoder enum
Values: default html
fields map string to object required
<string> object
type union anyOf

Supported values include:

  • plain: The plain highlighter uses the standard Lucene highlighter
  • fvh: The fvh highlighter uses the Lucene Fast Vector highlighter.
  • unified: The unified highlighter uses the Lucene Unified Highlighter.
Values: plain fvh unified
boundary_chars string · default: .,!? \t\n

A string that contains each boundary character.

boundary_max_scan number · default: 20

How far to scan for boundary characters.

boundary_scanner enum

Specifies how to break the highlighted fragments: chars, sentence, or word. Only valid for the unified and fvh highlighters. Defaults to sentence for the unified highlighter. Defaults to chars for the fvh highlighter.

Supported values include:

  • chars: Use the characters specified by boundary_chars as highlighting boundaries. The boundary_max_scan setting controls how far to scan for boundary characters. Only valid for the fvh highlighter.
  • sentence: Break highlighted fragments at the next sentence boundary, as determined by Java’s BreakIterator. You can specify the locale to use with boundary_scanner_locale. When used with the unified highlighter, the sentence scanner splits sentences bigger than fragment_size at the first word boundary next to fragment_size. You can set fragment_size to 0 to never split any sentence.
  • word: Break highlighted fragments at the next word boundary, as determined by Java’s BreakIterator. You can specify the locale to use with boundary_scanner_locale.
Values: chars sentence word
boundary_scanner_locale string · default: Locale.ROOT

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_source boolean deprecated
fragmenter enum · default: span

Specifies how text should be broken up in highlight snippets: simple or span. Only valid for the plain highlighter.

Values: simple span
fragment_size number · default: 100

The size of the highlighted fragment in characters.

highlight_filter boolean
highlight_query {} Query

Highlight matches for a query other than the search query. This is especially useful if you use a rescore query because those are not taken into account by highlighting by default.

max_fragment_length number
max_analyzed_offset number

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.

no_match_size number · default: 0

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

number_of_fragments number · default: 5

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.

options map string to object
order enum · default: none

Sorts highlighted fragments by score when set to score. By default, fragments will be output in the order they appear in the field (order: none). Setting this option to score will output the most relevant fragments first. Each highlighter applies its own logic to compute relevancy scores.

Values: score
phrase_limit number · default: 256

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_tags 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_tags 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.

require_field_match boolean · default: true

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

tags_schema enum

Set to styled to use the built-in tag schema.

Values: styled
fragment_offset number
matched_fields union oneOf
One of: string[] or string
ignore_unmapped boolean
script_fields map string to object
<string> object
script string required
ignore_failure boolean
seq_no_primary_term boolean
fields string[]
sort union oneOf

How the inner hits should be sorted per inner_hits. By default, inner hits are sorted by score.

A value or an array; each item is one of:

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

_source union oneOf
One of:
stored_fields union oneOf
One of: string[] or string
track_scores boolean · default: false
version boolean
max_concurrent_group_searches number

The number of concurrent requests allowed to retrieve the inner_hits per group

collapse object
Same fields as collapse
explain boolean · default: false

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

ext map string to object

Configuration of search extensions defined by Elasticsearch plugins.

from number · default: 0

Starting document offset. 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.

highlight object
Same fields as highlight in inner_hits
track_total_hits boolean | 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_boost string to number[]

Boosts the _score of documents from specified indices.

docvalue_fields object[]

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

field string required

A wildcard pattern. The request returns values for field names matching this pattern.

format string

The format in which the values are returned.

include_unmapped boolean
min_score number

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

post_filter {} Query
profile boolean
query {} Query

Defines the search definition using the Query DSL.

rescore union oneOf
object or object[]
window_size number
query object
rescore_query {} Query required

The query to use for rescoring. This query is only run on the Top-K results returned by the query and post_filter phases.

query_weight number · default: 1

Relative importance of the original query versus the rescore query.

rescore_query_weight number · default: 1

Relative importance of the rescore query versus the original query.

score_mode enum · default: total

Determines how scores are combined.

Supported values include:

  • avg: Average the original score and the rescore query score.
  • max: Take the max of original score and the rescore query score.
  • min: Take the min of the original score and the rescore query score.
  • multiply: Multiply the original score by the rescore query score. Useful for function query rescores.
  • total: Add the original score and the rescore query score.
Values: avg max min multiply total
learning_to_rank object
model_id string required

The unique identifier of the trained model uploaded to Elasticsearch

params map string to object

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

script_fields map string to object

Retrieve a script evaluation (based on different fields) for each hit.

<string> object
script string required
ignore_failure boolean
search_after union[]
size number · default: 10

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.

slice object
field string
id string required
max number required
sort union oneOf
Same options as sort in inner_hits
_source union oneOf

Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response.

One of:
fields object[]

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

field string required

A wildcard pattern. The request returns values for field names matching this pattern.

format string

The format in which the values are returned.

include_unmapped boolean
suggest object
text string

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

terminate_after number · default: 0

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. Defaults to 0, which does not terminate query execution early.

timeout string

Specifies 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.

track_scores boolean · default: false

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

version boolean · default: false

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

seq_no_primary_term boolean

If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control.

stored_fields union oneOf

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.

One of: string[] or string
pit object

Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an

id string required
keep_alive string
runtime_mappings object

Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.

stats string[]

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.

Response

application/json
took number required
timed_out boolean required
_shards object required
failed number required

The number of shards the operation or search attempted to run on but failed.

successful number required

The number of shards the operation or search succeeded on.

total number required

The number of shards the operation or search will run on overall.

failures object[]
index string
node string
reason object required
type string required

The type of error

reason union string nullable

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

One of: string
stack_trace string

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

caused_by object
Same fields as reason in failures
root_cause object[]
Same fields as reason in failures
suppressed object[]
Same fields as reason in failures
shard number
status string
primary boolean
skipped number
hits object required
total union oneOf

Total hit count information, present only if track_total_hits wasn't false in the search request.

One of:
relation enum required

Supported values include:

  • eq: Accurate
  • gte: Lower bound, including returned events or sequences
Values: eq gte
value number required
hits object[] required
_index string required
_id string
_score union number | string nullable
_explanation object
description string required
details object[] required
description string required
details object[]
Same fields as details in _explanation
value number required
value number required
fields map string to object
highlight map string to string
inner_hits map string to object
<string> object
hits object required
Same fields as hits
matched_queries union oneOf
One of: string[] or string to number
_nested object
field string required
offset number required
_nested object
Same fields as _nested in hits
_ignored string[]
ignored_field_values map string to oneOf
_shard string
_node string
_routing string
_source object
_rank number
_seq_no number
_primary_term number
_version number
sort union[]
max_score union number | string nullable
aggregations map string to {} Aggregation result
_clusters object
skipped number required
successful number required
total number required
running number required
partial number required
failed number required
details map string to object
<string> object
status enum required
Values: running successful partial skipped failed
indices string required
took number
timed_out boolean required
_shards object
Same fields as _shards
failures object[]
Same fields as failures in _shards
fields map string to object
max_score number
num_reduce_phases number
profile object
shards object[] required
aggregations object[] required
breakdown object required
build_aggregation number required
build_aggregation_count number required
build_leaf_collector number required
build_leaf_collector_count number required
collect number required
collect_count number required
initialize number required
initialize_count number required
post_collection number
post_collection_count number
reduce number required
reduce_count number required
description string required
time_in_nanos number required
type string required
debug object
segments_with_multi_valued_ords number
collection_strategy string
segments_with_single_valued_ords number
total_buckets number
built_buckets number
result_strategy string
has_filter boolean
delegate string
delegate_debug object
Same fields as debug in aggregations
chars_fetched number
extract_count number
extract_ns number
values_fetched number
collect_analyzed_ns number
collect_analyzed_count number
surviving_buckets number
ordinals_collectors_used number
ordinals_collectors_overhead_too_high number
string_hashing_collectors_used number
numeric_collectors_used number
empty_collectors_used number
deferred_aggregators string[]
segments_with_doc_count_field number
segments_with_deleted_docs number
filters object[]
results_from_metadata number
query string
specialized_for string
segments_counted_in_constant_time number
segments_counted number
segments_collected number
map_reducer string
brute_force_used number
dynamic_pruning_attempted number
dynamic_pruning_used number
skipped_due_to_no_data number
children object[]
Same fields as aggregations in shards
cluster string required
dfs object
statistics object
type string required
description string required
time string
time_in_nanos number required
breakdown object required
collection_statistics number required
collection_statistics_count number required
create_weight number required
create_weight_count number required
rewrite number required
rewrite_count number required
term_statistics number required
term_statistics_count number required
debug map string to object
children object[]
Same fields as statistics in dfs
knn object[]
vector_operations_count number
query object[] required
type string required
description string required
time string
time_in_nanos number required
breakdown object required
advance number required
advance_count number required
build_scorer number required
build_scorer_count number required
compute_max_score number required
compute_max_score_count number required
count_weight number required
count_weight_count number required
create_weight number required
create_weight_count number required
match number required
match_count number required
next_doc number required
next_doc_count number required
score number required
score_count number required
set_min_competitive_score number required
set_min_competitive_score_count number required
shallow_advance number required
shallow_advance_count number required
debug map string to object
children object[]
Same fields as query in knn
rewrite_time number required
collector object[] required
name string required
reason string required
time string
time_in_nanos number required
children object[]
Same fields as collector in knn
fetch object
type string required
description string required
time_in_nanos number required
breakdown object required
load_source number
load_source_count number
load_stored_fields number
load_stored_fields_count number
next_reader number
next_reader_count number
process_count number
process number
debug object
stored_fields string[]
fast_path number
children object[]
Same fields as fetch in shards
id string required
index string required
node_id string required
searches object[] required
collector object[] required
name string required
reason string required
time_in_nanos number required
children object[]
Same fields as collector in searches
query object[] required
breakdown object required
advance number required
advance_count number required
build_scorer number required
build_scorer_count number required
create_weight number required
create_weight_count number required
match number required
match_count number required
shallow_advance number required
shallow_advance_count number required
next_doc number required
next_doc_count number required
score number required
score_count number required
compute_max_score number required
compute_max_score_count number required
count_weight number required
count_weight_count number required
set_min_competitive_score number required
set_min_competitive_score_count number required
description string required
time_in_nanos number required
type string required
children object[]
Same fields as query in searches
rewrite_time number required
shard_id number required
pit_id string
_scroll_id string
suggest map string to oneOf
terminated_early boolean