Other search parameters

Some of the request body search parameters are easy to understand and access. Descriptions of these parameters are combined in the following table:

Parameter

docvalue_fields

Description

This parameter allows you to get the doc_value fields in the response for each hit.

Please refer to the Mapping parameters section in Chapter 4, Mapping APIs, for the doc_values.

Example

"docvalue_fields": ["field_1", {"field":"field_2", "format":"format_2"},...]

script_fields

Description

This parameter allows you to specify a test script to evaluate a field

and show the field in each hit of the response body.

Example

"script_fields": {"test": {"script": "doc['symbol']"}}

stored_fields

Description

This is the same description as in the URI search section.

Specify a list of comma-separated fields in an array, or _none_ to disable it.

An empty array specified with this parameter in the request body will have the return _id and _type field of each hit in the response body.

Example

"stored_field":["field1", "field2",...]

"stored_field":[]

"stored_field":"_none"

_source

Description

This is the same description as in the URI search section.

Wildcard patterns can be used in the field names.

Example

"_source": false

"_source":"field1"

"_source":["field1", "field2",...]

"_source":{"includes":["field1", "field2",...], "excludes":["field3", "field4",...]}

search_type

Description

This is the same description as in the URI search section.

Example

http://localhost:9200/cf_etf/_search?q=fund_name:ishares

&search_type=dfs_query_then_fetch

explain

Description

This is the same description as in the URI search section.

Example

"explain":true

 min_score

Description

Only those documents with a score greater than or equal to min_score are returned.

Example

"min_score":0.7

version

Description

This parameter is designed to return the document _version field.

Example

"version":true

seq_no_primary

_term

Description

This parameter is designed to return the _seq_no and _primary_term fields of the document.

Example

"seq_no_primary_term":true

preference

Description

This is a URL parameter that is designed to set the selected shard copies preference to execute the search request.

There are many different settings to choose from. Interested users can refer to the reference material.

Example

http://localhost:9200/cf_etf/_search?preference=_only_local

request_cache

Description

This is a URL parameter that is designed to turn on caching on a per-request basis.

If it is set, the index-level setting is overridden.

Example

http://localhost:9200/cf_etf/_search?request_cache=true

ccs_minimize

_roundtrips

Description

This parameter minimizes the network round-trips for the cross-cluster search request. The default setting is true. If it is set to false, this feature is disabled.

Example

"ccs_minimize_roundtrips":false

Since the search parameter inner_hits is related to the nested object or parent-join feature, we will introduce it in the next chapter. Furthermore, post_filter is related to aggregation, and we will describe it in Chapter 8, Aggregations Framework. In the next section, we will discuss how to address the search result by using query language in the search request body.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.69.53