Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ navigation_title: Collapse search results

# Collapse search results [collapse-search-results]

You can use the `collapse` parameter to collapse search results based on field values. The collapsing is done by selecting only the top sorted document per collapse key.
You can use the Search API's [`collapse` parameter](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-body-application-json-collapse) to collapse search results based on field values. The collapsing is done by selecting only the top sorted document per collapse key.

For example, the following search collapses results by `user.id` and sorts them by `http.response.bytes`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ For the most up-to-date API details, refer to [Index APIs](https://www.elastic.c

::::

The [create index from source API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-create-from) copies mappings and settings from a source index or data stream to a destination index or data stream, with optional overrides.


## {{api-request-title}} [indices-create-index-from-source-api-request]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ applies_to:

# Filter search results [filter-search-results]

You can use two methods to filter search results:
You can use the [search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) to filter results using either boolean `filter` clauses or the `post_filter` parameter.

* Use a boolean query with a `filter` clause. Search requests apply [boolean filters](/reference/query-languages/query-dsl/query-dsl-bool-query.md) to both search hits and [aggregations](/reference/aggregations/index.md).
* Use the search API’s `post_filter` parameter. Search requests apply [post filters](#post-filter) only to search hits, not aggregations. You can use a post filter to calculate aggregations based on a broader result set, and then further narrow the results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ navigation_title: Find text structure API examples
---
# Find text structure API examples

The [find text structure API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-text-structure-find-structure) provides a starting point for ingesting data into {{es}} in a format that is suitable for subsequent use with other Elastic Stack functionality. This page shows you examples of using the API.
The [find text structure API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-text-structure-find-structure) provides a starting point for ingesting data into {{es}} in a format that is suitable for subsequent use with other {{stack}} functionality. This page shows you examples of using the API.

## Finding the structure of NYC yellow cab example data [find-structure-example-nyc]

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/elasticsearch/rest-apis/highlighting.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ applies_to:

# Highlighting [highlighting]

Highlighters enable you to retrieve the best-matching highlighted snippets from one or more fields in your search results so you can show users where the query matches are. When you request highlights, the response contains an additional `highlight` element for each search hit that includes the highlighted fields and the highlighted fragments.
You can use the Search API's [`highlight` parameter](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-body-application-json-highlight)to retrieve the best-matching highlighted snippets from one or more fields in your search results so you can show users where the query matches are. When you request highlights, the response contains an additional `highlight` element for each search hit that includes the highlighted fields and the highlighted fragments. For the most up-to-date API details, refer to [search APIs](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-search).

::::{note}
Highlighters don’t reflect the boolean logic of a query when extracting terms to highlight. Thus, for some complex boolean queries (e.g nested boolean queries, queries using `minimum_should_match` etc.), parts of documents may be highlighted that don’t correspond to query matches.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ applies_to:

# Optimistic concurrency control [optimistic-concurrency-control]

Elasticsearch is distributed. When documents are created, updated, or deleted, the new version of the document has to be replicated to other nodes in the cluster. Elasticsearch is also asynchronous and concurrent, meaning that these replication requests are sent in parallel, and may arrive at their destination out of sequence. Elasticsearch needs a way of ensuring that an older version of a document never overwrites a newer version.
{{es}} is distributed. When documents are created, updated, or deleted, the new version of the document has to be replicated to other nodes in the cluster. {{es}} is also asynchronous and concurrent, meaning that these replication requests are sent in parallel, and may arrive at their destination out of sequence. {{es}} needs a way of ensuring that an older version of a document never overwrites a newer version.

To ensure an older version of a document doesn’t overwrite a newer version, every operation performed to a document is assigned a sequence number by the primary shard that coordinates that change. The sequence number is increased with each operation and thus newer operations are guaranteed to have a higher sequence number than older operations. Elasticsearch can then use the sequence number of operations to make sure a newer document version is never overridden by a change that has a smaller sequence number assigned to it.
To ensure an older version of a document doesn’t overwrite a newer version, every operation performed to a document is assigned a sequence number by the primary shard that coordinates that change. The sequence number is increased with each operation and thus newer operations are guaranteed to have a higher sequence number than older operations. {{es}} can then use the sequence number of operations to make sure a newer document version is never overridden by a change that has a smaller sequence number assigned to it.

For example, the following indexing command will create a document and assign it an initial sequence number and primary term:

Expand Down Expand Up @@ -41,7 +41,7 @@ You can see the assigned sequence number and primary term in the `_seq_no` and `
% TESTRESPONSE[s/"_seq_no": 362/"_seq_no": $body._seq_no/]
% TESTRESPONSE[s/"_primary_term": 2/"_primary_term": $body._primary_term/]

Elasticsearch keeps tracks of the sequence number and primary term of the last operation to have changed each of the documents it stores. The sequence number and primary term are returned in the `_seq_no` and `_primary_term` fields in the response of the [GET API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get):
{{es}} keeps tracks of the sequence number and primary term of the last operation to have changed each of the documents it stores. The sequence number and primary term are returned in the `_seq_no` and `_primary_term` fields in the response of the [GET API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get):

```console
GET products/_doc/1567
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ applies_to:

# Paginate search results [paginate-search-results]

By default, searches return the top 10 matching hits. To page through a larger set of results, you can use the [search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search)'s `from` and `size` parameters. The `from` parameter defines the number of hits to skip, defaulting to `0`. The `size` parameter is the maximum number of hits to return. Together, these two parameters define a page of results.
By default, searches return the top 10 matching hits. To page through a larger set of results, you can use the [search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search)'s [`from`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-from) and [`size`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-size) parameters. The `from` parameter defines the number of hits to skip, defaulting to `0`. The `size` parameter is the maximum number of hits to return. Together, these two parameters define a page of results.

```console
GET /_search
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/elasticsearch/rest-apis/query-api-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ navigation_title: Query API key information

# Query API key information examples

This page provides usage examples for the [Query API key information API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-query-api-keys), which retrieves API key metadata in a paginated fashion. These examples demonstrate how to retrieve, filter, sort, and aggregate API key data using query DSL and aggregation features.
The [Query API key information API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-query-api-keys) retrieves API key metadata in a paginated fashion. This page shows examples to demonstrate how to retrieve, filter, sort, and aggregate API key data using query DSL and aggregation features.

You can learn how to:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ applies_to:

# Reindex indices examples

This page provides examples of how to use the [Reindex API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-reindex).
The [Reindex API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-reindex) copies documents from a source index, data stream, or alias to a destination, allowing for optional data modification via scripts or ingest pipelines.

You can learn how to:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ applies_to:

# Rescore search results

Rescoring can help to improve precision by reordering just the top
(e.g. 100 - 500) documents returned by initial retrieval phase
(query, knn search) by using a secondary (usually more costly) algorithm,
instead of applying the costly algorithm to all documents in the index.
You can use the Search API's [`rescore` parameter](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-body-application-json-rescore)to rescore the top documents returned by a search request. Rescoring can help improve precision by reordering just the top (e.g. 100 - 500) documents returned by the initial retrieval phase (query, knn search) by using a secondary (usually more costly) algorithm, instead of applying the costly algorithm to all documents in the index.

## How `rescore` works [rescore]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ applies_to:

# Retrieve inner hits [inner-hits]

The [parent-join](/reference/elasticsearch/mapping-reference/parent-join.md) and [nested](/reference/elasticsearch/mapping-reference/nested.md) features allow the return of documents that have matches in a different scope. In the parent/child case, parent documents are returned based on matches in child documents or child documents are returned based on matches in parent documents. In the nested case, documents are returned based on matches in nested inner objects.
Use the [search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search) with the `inner_hits` parameter to retrieve the exact nested or parent/child documents that caused each search hit to match. The [parent-join](/reference/elasticsearch/mapping-reference/parent-join.md) and [nested](/reference/elasticsearch/mapping-reference/nested.md) features allow the return of documents that have matches in a different scope. In the parent/child case, parent documents are returned based on matches in child documents or child documents are returned based on matches in parent documents. In the nested case, documents are returned based on matches in nested inner objects.

In both cases, the actual matches in the different scopes that caused a document to be returned are hidden. In many cases, it’s very useful to know which inner nested objects (in the case of nested) or children/parent documents (in the case of parent/child) caused certain information to be returned. The inner hits feature can be used for this. This feature returns per search hit in the search response additional nested hits that caused a search hit to match in a different scope.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ applies_to:

# Retrieve stored fields using the Get document API [get-stored-fields]

Use the `stored_fields` query parameter in a [Get document](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get) API request to retrieve fields marked as stored (`"store": true`) in the index mapping.
You can use the Get API's [`stored_fields` parameter](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-get#operation-get-stored_fields) to retrieve fields marked as stored (`"store": true`) in the index mapping.

Fields not marked as stored are excluded from the response, even if specified in the request.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ applies_to:
---
# Suggester examples [search-suggesters]

The suggest feature suggests similar looking terms based on a provided text by using a suggester. The suggest request part is defined alongside the query part in a `_search` request. If the query part is left out, only suggestions are returned.
The [suggest parameter of the search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-body-application-json-suggest) suggests similar looking terms based on a provided text by using a suggester. The suggest request part is defined alongside the query part in a `_search` request. If the query part is left out, only suggestions are returned.

::::{note}
For the most up-to-date details, refer to [Search APIs](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-search).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ applies_to:

# Sort search results

Allows you to add one or more sorts on specific fields. Each sort can be reversed as well. The sort is defined on a per field level, with special field name for `_score` to sort by score, and `_doc` to sort by index order.
The [sortparameter in the search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search#operation-search-body-application-json-sort) allows you to add one or more sorts on specific fields. Each sort can be reversed as well. The sort is defined on a per field level, with special field name for `_score` to sort by score, and `_doc` to sort by index order.

To optimize sorting performance, avoid sorting by [`text`](/reference/elasticsearch/mapping-reference/text.md)fields; instead, use [`keyword`](/reference/elasticsearch/mapping-reference/keyword.md) or [`numerical`](/reference/elasticsearch/mapping-reference/number.md) fields. Additionally, you can improve performance by enabling pre-sorting at index time using [index sorting](/reference/elasticsearch/index-settings/sorting.md). While this can speed up query-time sorting, it may reduce indexing performance and increase memory usage.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ navigation_title: Term vectors API examples
---
# Term vectors API examples

[Term vectors](/reference/elasticsearch/mapping-reference/term-vector.md) provide information about the terms that were produced by the analysis process, including term frequencies, positions, offsets, and payloads. They're useful for applications like highlighting, more-like-this queries, and text analysis.
The [term vectors API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-termvectors) retrieves information and statistics about terms in the fields of a stored or artificial document, including their frequency, positions, and offsets.

This page shows you examples of using the [term vectors API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-termvectors).
[Term vectors](/reference/elasticsearch/mapping-reference/term-vector.md) provide information about the terms that were produced by the analysis process, including term frequencies, positions, offsets, and payloads. They're useful for applications like highlighting, more-like-this queries, and text analysis.

## Returning stored term vectors [docs-termvectors-api-stored-termvectors]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ applies_to:

# Update by query API examples

This page provides examples of how to use the [Update by query API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update-by-query).
The [Update by query API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-update-by-query) updates all documents that match a specified query, enabling bulk modification of the document source or metadata via a script.

You can learn how to:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ navigation_title: Vector tile search API

# Vector tile search API examples

This page shows how to create an index with geospatial data and retrieve vector tile results using the [vector tile search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt-1).
The [vector tile search API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt-1) searches for geospatial data within a specific tile coordinate (zoom/x/y) and returns the results as a binary Mapbox Vector Tile (MVT) containing hits, aggregations, and metadata. This page shows how to create an index with geospatial data and retrieve vector tile results using the API.


You can learn how to:
Expand Down
Loading