Restructure query-languages docs files for clarity (#124797)

In a few previous PR's we restructured the ES|QL docs to make it possible to generate them dynamically.

This PR just moves a few files around to make the query languages docs easier to work with, and a little more organized like the ES|QL docs.

A bit part of this was setting up redirects to the new locations, so other repo's could correctly link to the elasticsearch docs.
This commit is contained in:
Craig Taverner 2025-03-17 17:58:58 +01:00 committed by GitHub
parent 8c737fb235
commit 94cad286bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
188 changed files with 1021 additions and 969 deletions

View file

@ -305,5 +305,5 @@ POST hockey/_update_by_query
}
```
Note: all of the `_update_by_query` examples above could really do with a `query` to limit the data that they pull back. While you **could** use a [script query](/reference/query-languages/query-dsl-script-query.md) it wouldnt be as efficient as using any other query because script queries arent able to use the inverted index to limit the documents that they have to check.
Note: all of the `_update_by_query` examples above could really do with a `query` to limit the data that they pull back. While you **could** use a [script query](/reference/query-languages/query-dsl/query-dsl-script-query.md) it wouldnt be as efficient as using any other query because script queries arent able to use the inverted index to limit the documents that they have to check.

View file

@ -156,7 +156,7 @@ Wildcards are not accepted in the index expression for this endpoint. The expres
::::
Use this parameter to specify a query for computing a score. Besides deciding whether or not the document matches, the [query clause](/reference/query-languages/query-filter-context.md#query-context) also calculates a relevance score in the `_score` metadata field.
Use this parameter to specify a query for computing a score. Besides deciding whether or not the document matches, the [query clause](/reference/query-languages/query-dsl/query-filter-context.md#query-context) also calculates a relevance score in the `_score` metadata field.

View file

@ -19,10 +19,10 @@ Painless scripts typically run within one of the contexts in the following table
| Sort | [Painless Documentation](/reference/scripting-languages/painless/painless-sort-context.md) | [Elasticsearch Documentation](/reference/elasticsearch/rest-apis/sort-search-results.md) |
| Similarity | [Painless Documentation](/reference/scripting-languages/painless/painless-similarity-context.md) | [Elasticsearch Documentation](/reference/elasticsearch/index-settings/similarity.md) |
| Weight | [Painless Documentation](/reference/scripting-languages/painless/painless-weight-context.md) | [Elasticsearch Documentation](/reference/elasticsearch/index-settings/similarity.md) |
| Score | [Painless Documentation](/reference/scripting-languages/painless/painless-score-context.md) | [Elasticsearch Documentation](/reference/query-languages/query-dsl-function-score-query.md) |
| Score | [Painless Documentation](/reference/scripting-languages/painless/painless-score-context.md) | [Elasticsearch Documentation](/reference/query-languages/query-dsl/query-dsl-function-score-query.md) |
| Field | [Painless Documentation](/reference/scripting-languages/painless/painless-field-context.md) | [Elasticsearch Documentation](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#script-fields) |
| Filter | [Painless Documentation](/reference/scripting-languages/painless/painless-filter-context.md) | [Elasticsearch Documentation](/reference/query-languages/query-dsl-script-query.md) |
| Minimum should match | [Painless Documentation](/reference/scripting-languages/painless/painless-min-should-match-context.md) | [Elasticsearch Documentation](/reference/query-languages/query-dsl-terms-set-query.md) |
| Filter | [Painless Documentation](/reference/scripting-languages/painless/painless-filter-context.md) | [Elasticsearch Documentation](/reference/query-languages/query-dsl/query-dsl-script-query.md) |
| Minimum should match | [Painless Documentation](/reference/scripting-languages/painless/painless-min-should-match-context.md) | [Elasticsearch Documentation](/reference/query-languages/query-dsl/query-dsl-terms-set-query.md) |
| Metric aggregation initialization | [Painless Documentation](/reference/scripting-languages/painless/painless-metric-agg-init-context.md) | [Elasticsearch Documentation](/reference/data-analysis/aggregations/search-aggregations-metrics-scripted-metric-aggregation.md) |
| Metric aggregation map | [Painless Documentation](/reference/scripting-languages/painless/painless-metric-agg-map-context.md) | [Elasticsearch Documentation](/reference/data-analysis/aggregations/search-aggregations-metrics-scripted-metric-aggregation.md) |
| Metric aggregation combine | [Painless Documentation](/reference/scripting-languages/painless/painless-metric-agg-combine-context.md) | [Elasticsearch Documentation](/reference/data-analysis/aggregations/search-aggregations-metrics-scripted-metric-aggregation.md) |

View file

@ -7,7 +7,7 @@ mapped_pages:
## Debug.Explain [_debug_explain]
Painless doesnt have a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) and while itd be nice for it to have one day, it wouldnt tell you the whole story around debugging painless scripts embedded in Elasticsearch because the data that the scripts have access to or "context" is so important. For now the best way to debug embedded scripts is by throwing exceptions at choice places. While you can throw your own exceptions (`throw new Exception('whatever')`), Painlesss sandbox prevents you from accessing useful information like the type of an object. So Painless has a utility method, `Debug.explain` which throws the exception for you. For example, you can use [`_explain`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-explain) to explore the context available to a [script query](/reference/query-languages/query-dsl-script-query.md).
Painless doesnt have a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) and while itd be nice for it to have one day, it wouldnt tell you the whole story around debugging painless scripts embedded in Elasticsearch because the data that the scripts have access to or "context" is so important. For now the best way to debug embedded scripts is by throwing exceptions at choice places. While you can throw your own exceptions (`throw new Exception('whatever')`), Painlesss sandbox prevents you from accessing useful information like the type of an object. So Painless has a utility method, `Debug.explain` which throws the exception for you. For example, you can use [`_explain`](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-explain) to explore the context available to a [script query](/reference/query-languages/query-dsl/query-dsl-script-query.md).
```console
PUT /hockey/_doc/1?refresh

View file

@ -5,7 +5,7 @@ mapped_pages:
# Filter context [painless-filter-context]
Use a Painless script as a [filter](/reference/query-languages/query-dsl-script-query.md) in a query to include and exclude documents.
Use a Painless script as a [filter](/reference/query-languages/query-dsl/query-dsl-script-query.md) in a query to include and exclude documents.
**Variables**

View file

@ -5,7 +5,7 @@ mapped_pages:
# Minimum should match context [painless-min-should-match-context]
Use a Painless script to specify the [minimum](/reference/query-languages/query-dsl-terms-set-query.md) number of terms that a specified field needs to match with for a document to be part of the query results.
Use a Painless script to specify the [minimum](/reference/query-languages/query-dsl/query-dsl-terms-set-query.md) number of terms that a specified field needs to match with for a document to be part of the query results.
**Variables**

View file

@ -5,7 +5,7 @@ mapped_pages:
# Score context [painless-score-context]
Use a Painless script in a [function score](/reference/query-languages/query-dsl-function-score-query.md) to apply a new score to documents returned from a query.
Use a Painless script in a [function score](/reference/query-languages/query-dsl/query-dsl-function-score-query.md) to apply a new score to documents returned from a query.
**Variables**