elasticsearch/docs/reference
Michael Peterson ddba47407d
Collect and display execution metadata for ES|QL cross cluster searches (#112595)
Enhance ES|QL responses to include information about `took` time (search latency), shards, and
clusters against which the query was executed.

The goal of this PR is to begin to provide parity between the metadata displayed for 
cross-cluster searches in _search and ES|QL.

This PR adds the following features:
- add overall `took` time to all ES|QL query responses. And to emphasize: "all" here 
means: async search, sync search, local-only and cross-cluster searches, so it goes
beyond just CCS.
- add `_clusters` metadata to the final response for cross-cluster searches, for both
async and sync search (see example below)
- tracking/reporting counts of skipped shards from the can_match (SearchShards API)
phase of ES|QL processing
- marking clusters as skipped if they cannot be connected to (during the field-caps
phase of processing)

Out of scope for this PR:
- honoring the `skip_unavailable` cluster setting
- showing `_clusters` metadata in the async response **while** the search is still running
- showing any shard failure messages (since any shard search failures in ES|QL are
automatically fatal and _cluster/details is not shown in 4xx/5xx error responses). Note that 
this also means that the `failed` shard count is always 0 in ES|QL `_clusters` section.

Things changed with respect to behavior in `_search`:
- the `timed_out` field in `_clusters/details/mycluster` was removed in the ESQL
response, since ESQL does not support timeouts. It could be added back later
if/when ESQL supports timeouts.
- the `failures` array in `_clusters/details/mycluster/_shards` was removed in the ESQL
response, since any shard failure causes the whole query to fail.

Example output from ES|QL CCS:

```es
POST /_query
{
  "query": "from blogs,remote2:bl*,remote1:blogs|\nkeep authors.first_name,publish_date|\n limit 5"
}
```

```json
{
  "took": 49,
  "columns": [
    {
      "name": "authors.first_name",
      "type": "text"
    },
    {
      "name": "publish_date",
      "type": "date"
    }
  ],
  "values": [
    [
      "Tammy",
      "2009-11-04T04:08:07.000Z"
    ],
    [
      "Theresa",
      "2019-05-10T21:22:32.000Z"
    ],
    [
      "Jason",
      "2021-11-23T00:57:30.000Z"
    ],
    [
      "Craig",
      "2019-12-14T21:24:29.000Z"
    ],
    [
      "Alexandra",
      "2013-02-15T18:13:24.000Z"
    ]
  ],
  "_clusters": {
    "total": 3,
    "successful": 2,
    "running": 0,
    "skipped": 1,
    "partial": 0,
    "failed": 0,
    "details": {
      "(local)": {
        "status": "successful",
        "indices": "blogs",
        "took": 43,
        "_shards": {
          "total": 13,
          "successful": 13,
          "skipped": 0,
          "failed": 0
        }
      },
      "remote2": {
        "status": "skipped",  // remote2 was offline when this query was run
        "indices": "remote2:bl*",
        "took": 0,
        "_shards": {
          "total": 0,
          "successful": 0,
          "skipped": 0,
          "failed": 0
        }
      },
      "remote1": {
        "status": "successful",
        "indices": "remote1:blogs",
        "took": 47,
        "_shards": {
          "total": 13,
          "successful": 13,
          "skipped": 0,
          "failed": 0
        }
      }
    }
  }
}
```

Fixes https://github.com/elastic/elasticsearch/issues/112402 and https://github.com/elastic/elasticsearch/issues/110935
2024-09-30 16:03:39 -04:00
..
aggregations Deprecate legacy params from range query (#113286) 2024-09-25 14:48:45 -04:00
analysis Deprecate dutch_kp and lovins stemmer as they are removed in Lucene 10 (#113143) 2024-10-01 04:03:44 +10:00
autoscaling (Doc+) Link API doc to parent object - part1 (#111951) 2024-08-20 14:58:18 -06:00
behavioral-analytics/apis (Doc+) Link API doc to parent object - part1 (#111951) 2024-08-20 14:58:18 -06:00
cat (Doc+) CAT Nodes default columns (#112715) 2024-09-11 15:32:40 -06:00
ccr (Doc+) Link API doc to parent object - part1 (#111951) 2024-08-20 14:58:18 -06:00
cluster Implement remote cluster CCS telemetry (#112478) 2024-09-30 11:50:22 -06:00
commands fix typos (#113329) 2024-09-23 17:38:51 +02:00
connector [DOCS] Fix heading level (#113800) 2024-09-30 16:11:46 +02:00
data-management [DOC] auto migrate only for default template (#82043) 2022-05-10 11:35:19 -04:00
data-streams Expose global retention settings via data stream lifecycle API (#112210) 2024-09-02 18:40:08 +10:00
docs (+Doc) Link setting reference for action.auto_create_index (#110558) 2024-07-11 07:57:18 -06:00
eql (Doc+) Link API doc to parent object - part1 (#111951) 2024-08-20 14:58:18 -06:00
esql Collect and display execution metadata for ES|QL cross cluster searches (#112595) 2024-09-30 16:03:39 -04:00
features/apis Simplify reset-features API (#110866) 2024-07-15 13:23:21 +01:00
fleet [Fleet] Fix Fleet API docs (#97981) 2023-07-27 17:22:44 +02:00
graph Fix a couple of docs typos (#99028) 2023-08-30 09:01:34 -04:00
health [DOCS] Fixes the description of 'affected_resources' in health API documentation (#111833) 2024-08-13 18:51:49 +02:00
high-availability Round up shard allocation / recovery / relocation concepts (#109943) 2024-07-25 14:44:57 -04:00
how-to (Doc+) "min_primary_shard_size" for 10-50GB shards (#111574) 2024-08-21 11:57:09 +02:00
ilm #101193 Preserve Step Info Across ILM Auto Retries (#113187) 2024-09-30 11:44:46 +01:00
images [DOCS] Update Using ESQL in Kibana doc (#108715) 2024-05-17 12:36:04 +02:00
index-modules #101472 Updates default index.translog.flush_threshold_size value (#112052) 2024-09-10 11:08:53 +02:00
indices Adding component template substitutions to the simulate ingest API (#113276) 2024-09-25 15:30:22 -05:00
inference [DOCS] Improves semantic text documentation. (#113606) 2024-09-26 16:09:28 +02:00
ingest [DOCS] Port connector docs from Enterprise Search guide (#112953) 2024-09-30 10:22:37 +02:00
licensing [DOCS] Remove testenv annotations from doc snippet tests (#80023) 2021-11-05 18:38:50 -04:00
mapping Revert "Apply auto-flattening to subobjects: auto (#112092)" (#113692) 2024-09-30 10:11:15 +03:00
migration Forward port release notes for v8.15.0 (#111714) 2024-08-08 18:10:39 +01:00
ml [ML] Add documentation for post calendar events API (#113188) 2024-09-24 09:46:42 +02:00
modules ESQL: Document esql_worker threadpool (#113203) 2024-09-23 11:03:37 -04:00
monitoring [Docs] Update Monitoring docs with integration assets info (#112164) 2024-09-04 16:07:45 -04:00
query-dsl Add inner hits support to semantic query (#111834) 2024-09-27 10:51:11 -04:00
query-rules/apis [Query rules] Add exclude query rule type (#111420) 2024-08-02 08:03:54 -04:00
quickstart [DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436) 2024-09-25 17:30:01 +02:00
release-notes Added known issue entry for synthetic source bug. (#113269) 2024-09-23 07:06:55 +02:00
repositories-metering-api [DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413) 2024-04-17 14:37:07 +02:00
reranking [DOCS] Fix reranking IA, move retrievers to search api overview (#112949) 2024-09-19 17:20:52 +02:00
rest-api [ML] Add deployment threading details and memory usage to telemetry (#113099) 2024-09-23 16:08:46 +01:00
rollup Revert "Emit deprecation warning when executing one of the rollup APIs (#112807)" (#113047) 2024-09-18 05:30:35 +10:00
scripting Aggs: Scripted metric allow list docs (#109635) 2024-07-11 14:27:51 +02:00
search [DOCS] Add snippet tests to retriever API docs (#113289) 2024-09-23 16:59:01 +02:00
search-application/apis Allow typed_keys for search application Search API (#108007) 2024-04-30 11:31:45 +02:00
searchable-snapshots Updates-warning-about-mounting-snapshots (#112057) 2024-08-22 12:22:32 +02:00
security (Doc+) Update example SAML blog for Okta (#112934) 2024-09-18 12:04:44 +02:00
settings fix typos (#113329) 2024-09-23 17:38:51 +02:00
setup Mention full-cluster restart in initial_master_node docs (#112986) 2024-09-19 10:41:39 +01:00
shutdown/apis [DOCS] Align docs to implementation for timeout parameters (#108593) 2024-05-16 13:05:39 +10:00
slm/apis Add interval based SLM scheduling (#110847) 2024-08-22 21:15:29 -05:00
snapshot-restore [docs] Fix typo in repository-s3.asciidoc (#113678) 2024-09-27 20:36:22 +10:00
sql Removing server from the version compatibility table (#109168) 2024-05-29 11:57:46 -06:00
synonyms/apis Clarify synonyms docs (#110822) 2024-07-18 10:20:26 +02:00
tab-widgets [DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436) 2024-09-25 17:30:01 +02:00
text-structure/apis [DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413) 2024-04-17 14:37:07 +02:00
transform [DOCS] Adds an admonition to the transform painless examples. (#113706) 2024-09-30 09:28:28 +02:00
troubleshooting (Doc+) Avoid search pile up by setting default timeout (#112846) 2024-09-26 09:05:21 -06:00
upgrade (Doc+) Link Gateway Settings to Full Restart (#110902) 2024-07-25 09:10:19 -06:00
vectors Adds new bit element_type for dense_vectors (#110059) 2024-06-27 04:48:41 +10:00
watcher Deprecate legacy params from range query (#113286) 2024-09-25 14:48:45 -04:00
aggregations.asciidoc
alias.asciidoc Mention alias filters don't apply for get-by-id in docs (#108433) 2024-05-08 15:28:25 -06:00
analysis.asciidoc Update Lucene analysis base url (#84094) 2022-02-17 12:44:12 +01:00
api-conventions.asciidoc Add known issue docs for #111854 (#111978) 2024-08-20 07:25:55 +01:00
cat.asciidoc Add 'dataset' size to cat indices and cat shards (#98622) 2023-08-22 15:36:32 -06:00
cluster.asciidoc Fix voting_only:true in node spec docs (#99099) 2023-08-31 17:41:50 +01:00
data-management.asciidoc [DOCS] Update tech preview copy (#101606) 2023-10-31 10:31:07 -04:00
data-rollup-transform.asciidoc [DOCS] Deprecate rollups (#101265) 2023-10-25 16:52:25 -04:00
datatiers.asciidoc (Doc+) Flush out Data Tiers (#107981) 2024-07-18 14:35:41 -06:00
dependencies-versions.asciidoc [DOCS] Replace dependencies list with a link. Closes #84863 (#90694) 2022-11-09 14:37:55 -08:00
docs.asciidoc
geospatial-analysis.asciidoc Simple addition of ES|QL to geo overview page (#111158) 2024-07-23 12:00:05 +02:00
gs-index.asciidoc
high-availability.asciidoc [DOCS] Overhaul snapshot and restore docs (#79081) 2021-11-15 12:45:07 -05:00
how-to.asciidoc Add guide for tuning kNN search (#89782) 2022-10-12 14:53:53 -07:00
index-modules.asciidoc Remove zstd feature flag for index codec best compression. (#112665) 2024-09-13 10:49:49 +02:00
index.asciidoc [DOCS] Port connector docs from Enterprise Search guide (#112953) 2024-09-30 10:22:37 +02:00
index.x.asciidoc
indices.asciidoc Resolve Cluster API (#102726) 2024-02-08 10:50:05 -05:00
ingest.asciidoc [DOCS] Port connector docs from Enterprise Search guide (#112953) 2024-09-30 10:22:37 +02:00
intro.asciidoc [DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436) 2024-09-25 17:30:01 +02:00
landing-page.asciidoc [DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436) 2024-09-25 17:30:01 +02:00
links.asciidoc
mapping.asciidoc [DOCS][101] Refine mappings + documents/indices overviews (#112545) 2024-09-10 12:17:10 +02:00
query-dsl.asciidoc Group vector queries into new section (#110722) 2024-07-11 14:45:35 +02:00
redirects.asciidoc [DOCS] Add ES quickstart (#102226) 2023-11-24 15:27:41 +01:00
release-notes.asciidoc Forward port release notes for v8.15.1 (#112568) 2024-09-16 17:21:38 +02:00
run-elasticsearch-locally.asciidoc [DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436) 2024-09-25 17:30:01 +02:00
scripting.asciidoc [DOCS] Add documentation for Painless field API (#83388) 2022-02-03 15:15:38 -05:00
search.asciidoc Add retrievers using the parser-only approach (#105470) 2024-03-12 10:11:55 -07:00
setup.asciidoc [DOCS] Create Elasticsearch basics section, refactor quickstarts section (#112436) 2024-09-25 17:30:01 +02:00
troubleshooting.asciidoc (Doc+) Capture Elasticsearch diagnostic (#108259) 2024-05-09 10:27:19 -06:00
upgrade.asciidoc [DOCS] Refactor book-scoped variables in docs/reference/index.asciidoc (#107413) 2024-04-17 14:37:07 +02:00