mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
While the internal structure of the docs is already split into many (over 1000) sub-pages, the final display for the `Functions and Operators` page is a single giant page, making navigation harder. This PR splits it into separate pages, one for each group of similar functions and one for the operators. Twelve new pages. This PR also bundles a few other related changes. In total what is done is: * Split functions/operators into 12 pages, one for each group, maintaining the existing split of each function/operator into a snippet with dynamically generated examples * Split esql-commands.md into source-commands.md and processing-commands.md, each of which is split into individual snippets, one for each command * Each command snippet has it's examples split out into separate files, if they were examples that were dynamically generated in the older asciidoc system * The examples files are overwritten by the ES|QL unit tests, using a similar mechanism to the examples written for functions and operators) * Some additional refinements to the Kibana definition and markdown files (nicer operator headings, and display text)
2.5 KiB
2.5 KiB
navigation_title | mapped_pages | |
---|---|---|
Metadata fields |
|
{{esql}} metadata fields [esql-metadata-fields]
{{esql}} can access metadata fields. The currently supported ones are:
_index
: the index to which the document belongs. The field is of the type keyword._id
: the source document’s ID. The field is of the type keyword._version
: the source document’s version. The field is of the type long._ignored
: the ignored source document fields. The field is of the type keyword._score
: when enabled, the final score assigned to each row matching an ES|QL query. Scoring will be updated when using full text search functions.
To enable the access to these fields, the FROM
source command needs to be provided with a dedicated directive:
FROM index METADATA _index, _id
Metadata fields are only available if the source of the data is an index. Consequently, FROM
is the only source commands that supports the METADATA
directive.
Once enabled, these fields will be available to subsequent processing commands, just like other index fields:
FROM ul_logs, apps METADATA _index, _version
| WHERE id IN (13, 14) AND _version == 1
| EVAL key = CONCAT(_index, "_", TO_STR(id))
| SORT id, _index
| KEEP id, _index, _version, key
id:long | _index:keyword | _version:long | key:keyword |
---|---|---|---|
13 | apps | 1 | apps_13 |
13 | ul_logs | 1 | ul_logs_13 |
14 | apps | 1 | apps_14 |
14 | ul_logs | 1 | ul_logs_14 |
Similar to index fields, once an aggregation is performed, a metadata field will no longer be accessible to subsequent commands, unless used as a grouping field:
FROM employees METADATA _index, _id
| STATS max = MAX(emp_no) BY _index
max:integer | _index:keyword |
---|---|
10100 | employees |