From 26d51089da983a0dccaeb28f2f1e5cc938168fa2 Mon Sep 17 00:00:00 2001 From: James Rodewig <40268737+jrodewig@users.noreply.github.com> Date: Mon, 3 Aug 2020 13:31:19 -0400 Subject: [PATCH] [DOCS] Replace `twitter` dataset in docs (#60604) (#60609) --- docs/reference/cluster/health.asciidoc | 4 +- docs/reference/cluster/stats.asciidoc | 2 +- docs/reference/commands/shard-tool.asciidoc | 2 +- docs/reference/docs/delete.asciidoc | 4 +- docs/reference/eql/eql-search-api.asciidoc | 8 +- docs/reference/frozen-indices.asciidoc | 16 ++-- docs/reference/index-modules/blocks.asciidoc | 4 +- .../index-modules/index-sorting.asciidoc | 4 +- docs/reference/index-modules/slowlog.asciidoc | 8 +- docs/reference/indices/aliases.asciidoc | 14 ++-- .../indices/component-templates.asciidoc | 2 +- docs/reference/indices/create-index.asciidoc | 2 +- .../indices/put-component-template.asciidoc | 2 +- .../indices/put-index-template-v1.asciidoc | 2 +- .../indices/put-index-template.asciidoc | 2 +- .../mapping/fields/source-field.asciidoc | 2 +- .../modules/cluster/disk_allocator.asciidoc | 6 +- .../modules/cross-cluster-search.asciidoc | 78 +++++++++++++------ .../modules/indices/request_cache.asciidoc | 4 +- docs/reference/query-dsl/bool-query.asciidoc | 8 +- .../query-dsl/constant-score-query.asciidoc | 2 +- .../reference/query-dsl/exists-query.asciidoc | 4 +- .../query-dsl/function-score-query.asciidoc | 16 ++-- .../reference/query-dsl/prefix-query.asciidoc | 4 +- .../query-dsl/query-string-syntax.asciidoc | 6 +- .../reference/query-dsl/regexp-query.asciidoc | 4 +- .../query-dsl/span-first-query.asciidoc | 2 +- .../query-dsl/span-term-query.asciidoc | 6 +- docs/reference/query-dsl/term-query.asciidoc | 4 +- docs/reference/query-dsl/terms-query.asciidoc | 6 +- .../query-dsl/wildcard-query.asciidoc | 4 +- .../query-dsl/wrapper-query.asciidoc | 4 +- docs/reference/scripting/using.asciidoc | 6 +- docs/reference/search.asciidoc | 26 ++++--- 34 files changed, 151 insertions(+), 117 deletions(-) diff --git a/docs/reference/cluster/health.asciidoc b/docs/reference/cluster/health.asciidoc index 767bc9b8f1c..869a72e7f49 100644 --- a/docs/reference/cluster/health.asciidoc +++ b/docs/reference/cluster/health.asciidoc @@ -184,6 +184,6 @@ The following is an example of getting the cluster health at the [source,console] -------------------------------------------------- -GET /_cluster/health/twitter?level=shards +GET /_cluster/health/my-index-000001?level=shards -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] diff --git a/docs/reference/cluster/stats.asciidoc b/docs/reference/cluster/stats.asciidoc index 5cd77764b03..c3cdf95a623 100644 --- a/docs/reference/cluster/stats.asciidoc +++ b/docs/reference/cluster/stats.asciidoc @@ -1100,7 +1100,7 @@ Number of selected nodes using the distribution flavor and file type. -------------------------------------------------- GET /_cluster/stats?human&pretty -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] The API returns the following response: diff --git a/docs/reference/commands/shard-tool.asciidoc b/docs/reference/commands/shard-tool.asciidoc index 7af16af2120..42069e50325 100644 --- a/docs/reference/commands/shard-tool.asciidoc +++ b/docs/reference/commands/shard-tool.asciidoc @@ -57,7 +57,7 @@ operation that removes corrupted data from the shard. [source,txt] -------------------------------------------------- -$ bin/elasticsearch-shard remove-corrupted-data --index twitter --shard-id 0 +$ bin/elasticsearch-shard remove-corrupted-data --index my-index-000001 --shard-id 0 WARNING: Elasticsearch MUST be stopped before running this tool. diff --git a/docs/reference/docs/delete.asciidoc b/docs/reference/docs/delete.asciidoc index 649006a3ff1..eb2169fbb34 100644 --- a/docs/reference/docs/delete.asciidoc +++ b/docs/reference/docs/delete.asciidoc @@ -63,7 +63,7 @@ Example to delete with routing [source,console] -------------------------------------------------- -PUT /my-index-000001/_doc/1?routing=kimchy +PUT /my-index-000001/_doc/1?routing=shard-1 { "test": "test" } @@ -73,7 +73,7 @@ PUT /my-index-000001/_doc/1?routing=kimchy [source,console] -------------------------------------------------- -DELETE /my-index-000001/_doc/1?routing=kimchy +DELETE /my-index-000001/_doc/1?routing=shard-1 -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/eql/eql-search-api.asciidoc b/docs/reference/eql/eql-search-api.asciidoc index 6a5c5358268..3cadf18560f 100644 --- a/docs/reference/eql/eql-search-api.asciidoc +++ b/docs/reference/eql/eql-search-api.asciidoc @@ -506,14 +506,14 @@ The following EQL search request searches for events with an `event.category` of `file` that meet the following conditions: * A `file.name` of `cmd.exe` -* An `agent.id` other than `my_user` +* An `agent.id` other than `8a4f526c` [source,console] ---- GET /my-index-00001/_eql/search { "query": """ - file where (file.name == "cmd.exe" and agent.id != "my_user") + file where (file.name == "cmd.exe" and agent.id != "8a4f526c") """ } ---- @@ -616,7 +616,7 @@ that: -- * An `event.category` of `file` * A `file.name` of `cmd.exe` -* An `agent.id` other than `my_user` +* An `agent.id` other than `8a4f526c` -- . Followed by an event with: + @@ -633,7 +633,7 @@ GET /my-index-00001/_eql/search { "query": """ sequence by agent.id - [ file where file.name == "cmd.exe" and agent.id != "my_user" ] + [ file where file.name == "cmd.exe" and agent.id != "8a4f526c" ] [ process where stringContains(process.executable, "regsvr32") ] """ } diff --git a/docs/reference/frozen-indices.asciidoc b/docs/reference/frozen-indices.asciidoc index 5a2ef125a8c..3c634341ff3 100644 --- a/docs/reference/frozen-indices.asciidoc +++ b/docs/reference/frozen-indices.asciidoc @@ -64,9 +64,9 @@ or sorted search requests. [source,console] -------------------------------------------------- -POST /twitter/_forcemerge?max_num_segments=1 +POST /my-index-000001/_forcemerge?max_num_segments=1 -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] [role="xpack"] [testenv="basic"] @@ -81,9 +81,9 @@ the query parameter `ignore_throttled=false`. [source,console] -------------------------------------------------- -GET /twitter/_search?q=user:kimchy&ignore_throttled=false +GET /my-index-000001/_search?q=user.id:kimchy&ignore_throttled=false -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] [role="xpack"] [testenv="basic"] @@ -95,16 +95,16 @@ Frozen indices are ordinary indices that use search throttling and a memory effi [source,console] -------------------------------------------------- -GET /_cat/indices/twitter?v&h=i,sth +GET /_cat/indices/my-index-000001?v&h=i,sth -------------------------------------------------- -// TEST[s/^/PUT twitter\nPOST twitter\/_freeze\n/] +// TEST[s/^/PUT my-index-000001\nPOST my-index-000001\/_freeze\n/] The response looks like: [source,txt] -------------------------------------------------- -i sth -twitter true +i sth +my-index-000001 true -------------------------------------------------- // TESTRESPONSE[non_json] diff --git a/docs/reference/index-modules/blocks.asciidoc b/docs/reference/index-modules/blocks.asciidoc index da4297cf225..d54b8f7e9be 100644 --- a/docs/reference/index-modules/blocks.asciidoc +++ b/docs/reference/index-modules/blocks.asciidoc @@ -74,9 +74,9 @@ Adds an index block to an index. [source,console] -------------------------------------------------- -PUT /twitter/_block/write +PUT /my-index-000001/_block/write -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] [discrete] diff --git a/docs/reference/index-modules/index-sorting.asciidoc b/docs/reference/index-modules/index-sorting.asciidoc index 6cedcbee4f0..e32684c8264 100644 --- a/docs/reference/index-modules/index-sorting.asciidoc +++ b/docs/reference/index-modules/index-sorting.asciidoc @@ -14,7 +14,7 @@ For instance the following example shows how to define a sort on a single field: [source,console] -------------------------------------------------- -PUT twitter +PUT my-index-000001 { "settings": { "index": { @@ -39,7 +39,7 @@ It is also possible to sort the index by more than one field: [source,console] -------------------------------------------------- -PUT twitter +PUT my-index-000001 { "settings": { "index": { diff --git a/docs/reference/index-modules/slowlog.asciidoc b/docs/reference/index-modules/slowlog.asciidoc index 418507c4f22..2bbc80e5e81 100644 --- a/docs/reference/index-modules/slowlog.asciidoc +++ b/docs/reference/index-modules/slowlog.asciidoc @@ -31,7 +31,7 @@ All of the above settings are _dynamic_ and can be set for each index using the [source,console] -------------------------------------------------- -PUT /twitter/_settings +PUT /my-index-000001/_settings { "index.search.slowlog.threshold.query.warn": "10s", "index.search.slowlog.threshold.query.info": "5s", @@ -44,7 +44,7 @@ PUT /twitter/_settings "index.search.slowlog.level": "info" } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] By default, none are enabled (set to `-1`). Levels (`warn`, `info`, `debug`, `trace`) allow to control under which logging level the log @@ -141,7 +141,7 @@ All of the above settings are _dynamic_ and can be set for each index using the [source,console] -------------------------------------------------- -PUT /twitter/_settings +PUT /my-index-000001/_settings { "index.indexing.slowlog.threshold.index.warn": "10s", "index.indexing.slowlog.threshold.index.info": "5s", @@ -151,7 +151,7 @@ PUT /twitter/_settings "index.indexing.slowlog.source": "1000" } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] By default Elasticsearch will log the first 1000 characters of the _source in the slowlog. You can change that with `index.indexing.slowlog.source`. Setting diff --git a/docs/reference/indices/aliases.asciidoc b/docs/reference/indices/aliases.asciidoc index 935a2bbf906..0f9351daed6 100644 --- a/docs/reference/indices/aliases.asciidoc +++ b/docs/reference/indices/aliases.asciidoc @@ -302,19 +302,23 @@ exist in the mapping: [source,console] -------------------------------------------------- -PUT /test1 +PUT /my-index-000001 { "mappings": { "properties": { - "user" : { - "type": "keyword" + "user": { + "properties": { + "id": { + "type": "keyword" + } + } } } } } -------------------------------------------------- -Now we can create an alias that uses a filter on field `user`: +Now we can create an alias that uses a filter on field `user.id`: [source,console] -------------------------------------------------- @@ -323,7 +327,7 @@ POST /_aliases "actions": [ { "add": { - "index": "test1", + "index": "my-index-000001", "alias": "alias2", "filter": { "term": { "user.id": "kimchy" } } } diff --git a/docs/reference/indices/component-templates.asciidoc b/docs/reference/indices/component-templates.asciidoc index 2d0b71fbdc6..9c3441582ee 100644 --- a/docs/reference/indices/component-templates.asciidoc +++ b/docs/reference/indices/component-templates.asciidoc @@ -141,7 +141,7 @@ PUT _component_template/template_1 "filter" : { "term" : {"user.id" : "kimchy" } }, - "routing" : "kimchy" + "routing" : "shard-1" }, "{index}-alias" : {} <1> } diff --git a/docs/reference/indices/create-index.asciidoc b/docs/reference/indices/create-index.asciidoc index 1f5e76cfa8c..e1b829d5172 100644 --- a/docs/reference/indices/create-index.asciidoc +++ b/docs/reference/indices/create-index.asciidoc @@ -155,7 +155,7 @@ PUT /test "filter": { "term": { "user.id": "kimchy" } }, - "routing": "kimchy" + "routing": "shard-1" } } } diff --git a/docs/reference/indices/put-component-template.asciidoc b/docs/reference/indices/put-component-template.asciidoc index 73748444acc..c5c48cb521f 100644 --- a/docs/reference/indices/put-component-template.asciidoc +++ b/docs/reference/indices/put-component-template.asciidoc @@ -138,7 +138,7 @@ PUT _component_template/template_1 "filter" : { "term" : {"user.id" : "kimchy" } }, - "routing" : "kimchy" + "routing" : "shard-1" }, "{index}-alias" : {} <1> } diff --git a/docs/reference/indices/put-index-template-v1.asciidoc b/docs/reference/indices/put-index-template-v1.asciidoc index da0ec904f7c..4085433db4e 100644 --- a/docs/reference/indices/put-index-template-v1.asciidoc +++ b/docs/reference/indices/put-index-template-v1.asciidoc @@ -152,7 +152,7 @@ PUT _template/template_1 "filter" : { "term" : {"user.id" : "kimchy" } }, - "routing" : "kimchy" + "routing" : "shard-1" }, "{index}-alias" : {} <1> } diff --git a/docs/reference/indices/put-index-template.asciidoc b/docs/reference/indices/put-index-template.asciidoc index 013c94c9f2c..5f84c1e1527 100644 --- a/docs/reference/indices/put-index-template.asciidoc +++ b/docs/reference/indices/put-index-template.asciidoc @@ -155,7 +155,7 @@ PUT _index_template/template_1 "filter" : { "term" : {"user.id" : "kimchy" } }, - "routing" : "kimchy" + "routing" : "shard-1" }, "{index}-alias" : {} <1> } diff --git a/docs/reference/mapping/fields/source-field.asciidoc b/docs/reference/mapping/fields/source-field.asciidoc index 270d62076c1..f677986fccc 100644 --- a/docs/reference/mapping/fields/source-field.asciidoc +++ b/docs/reference/mapping/fields/source-field.asciidoc @@ -14,7 +14,7 @@ within the index. For this reason, it can be disabled as follows: [source,console] -------------------------------------------------- -PUT tweets +PUT my-index-000001 { "mappings": { "_source": { diff --git a/docs/reference/modules/cluster/disk_allocator.asciidoc b/docs/reference/modules/cluster/disk_allocator.asciidoc index 21bca605686..e3d195d94e1 100644 --- a/docs/reference/modules/cluster/disk_allocator.asciidoc +++ b/docs/reference/modules/cluster/disk_allocator.asciidoc @@ -51,16 +51,16 @@ Controls the flood stage watermark, which defaults to 95%. {es} enforces a read- NOTE: You cannot mix the usage of percentage values and byte values within these settings. Either all values are set to percentage values, or all are set to byte values. This enforcement is so that {es} can validate that the settings are internally consistent, ensuring that the low disk threshold is less than the high disk threshold, and the high disk threshold is less than the flood stage threshold. -An example of resetting the read-only index block on the `twitter` index: +An example of resetting the read-only index block on the `my-index-000001` index: [source,console] -------------------------------------------------- -PUT /twitter/_settings +PUT /my-index-000001/_settings { "index.blocks.read_only_allow_delete": null } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] -- // end::cluster-routing-flood-stage-tag[] diff --git a/docs/reference/modules/cross-cluster-search.asciidoc b/docs/reference/modules/cross-cluster-search.asciidoc index e5dafd6ed7f..756effb3173 100644 --- a/docs/reference/modules/cross-cluster-search.asciidoc +++ b/docs/reference/modules/cross-cluster-search.asciidoc @@ -66,22 +66,22 @@ PUT _cluster/settings ==== Search a single remote cluster The following <> API request searches the -`twitter` index on a single remote cluster, `cluster_one`. +`my-index-000001` index on a single remote cluster, `cluster_one`. [source,console] -------------------------------------------------- -GET /cluster_one:twitter/_search +GET /cluster_one:my-index-000001/_search { "query": { "match": { - "user": "kimchy" + "user.id": "kimchy" } }, - "_source": ["user", "message", "likes"] + "_source": ["user.id", "message", "http.response.status_code"] } -------------------------------------------------- // TEST[continued] -// TEST[setup:twitter] +// TEST[setup:my_index] The API returns the following response: @@ -109,14 +109,21 @@ The API returns the following response: "max_score": 1, "hits": [ { - "_index": "cluster_one:twitter", <1> + "_index": "cluster_one:my-index-000001", <1> "_type": "_doc", "_id": "0", "_score": 1, "_source": { - "user": "kimchy", - "message": "trying out Elasticsearch", - "likes": 0 + "user": { + "id": "kimchy" + }, + "message": "GET /search HTTP/1.1 200 1070000", + "http": { + "response": + { + "status_code": 200 + } + } } } ] @@ -134,7 +141,7 @@ The API returns the following response: [[ccs-search-multi-remote-cluster]] ==== Search multiple remote clusters -The following <> API request searches the `twitter` index on +The following <> API request searches the `my-index-000001` index on three clusters: * Your local cluster @@ -142,14 +149,14 @@ three clusters: [source,console] -------------------------------------------------- -GET /twitter,cluster_one:twitter,cluster_two:twitter/_search +GET /my-index-000001,cluster_one:my-index-000001,cluster_two:my-index-000001/_search { "query": { "match": { - "user": "kimchy" + "user.id": "kimchy" } }, - "_source": ["user", "message", "likes"] + "_source": ["user.id", "message", "http.response.status_code"] } -------------------------------------------------- // TEST[continued] @@ -181,36 +188,57 @@ The API returns the following response: "max_score": 1, "hits": [ { - "_index": "twitter", <1> + "_index": "my-index-000001", <1> "_type": "_doc", "_id": "0", "_score": 2, "_source": { - "user": "kimchy", - "message": "trying out Elasticsearch", - "likes": 0 + "user": { + "id": "kimchy" + }, + "message": "GET /search HTTP/1.1 200 1070000", + "http": { + "response": + { + "status_code": 200 + } + } } }, { - "_index": "cluster_one:twitter", <2> + "_index": "cluster_one:my-index-000001", <2> "_type": "_doc", "_id": "0", "_score": 1, "_source": { - "user": "kimchy", - "message": "trying out Elasticsearch", - "likes": 0 + "user": { + "id": "kimchy" + }, + "message": "GET /search HTTP/1.1 200 1070000", + "http": { + "response": + { + "status_code": 200 + } + } } }, { - "_index": "cluster_two:twitter", <3> + "_index": "cluster_two:my-index-000001", <3> "_type": "_doc", "_id": "0", "_score": 1, "_source": { - "user": "kimchy", - "message": "trying out Elasticsearch", - "likes": 0 + "user": { + "id": "kimchy" + }, + "message": "GET /search HTTP/1.1 200 1070000", + "http": { + "response": + { + "status_code": 200 + } + } } } ] diff --git a/docs/reference/modules/indices/request_cache.asciidoc b/docs/reference/modules/indices/request_cache.asciidoc index 6dc900ecb7b..6208f09bf08 100644 --- a/docs/reference/modules/indices/request_cache.asciidoc +++ b/docs/reference/modules/indices/request_cache.asciidoc @@ -45,9 +45,9 @@ The cache can be expired manually with the <> with the `exists` query. The following search returns documents that are missing an indexed value for -the `user` field. +the `user.id` field. [source,console] ---- @@ -60,7 +60,7 @@ GET /_search "bool": { "must_not": { "exists": { - "field": "user" + "field": "user.id" } } } diff --git a/docs/reference/query-dsl/function-score-query.asciidoc b/docs/reference/query-dsl/function-score-query.asciidoc index 8477d9115ba..15c7f047d32 100644 --- a/docs/reference/query-dsl/function-score-query.asciidoc +++ b/docs/reference/query-dsl/function-score-query.asciidoc @@ -29,7 +29,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] <1> See <> for a list of supported functions. @@ -64,7 +64,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] <1> Boost for the whole query. <2> See <> for a list of supported functions. @@ -151,7 +151,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] [IMPORTANT] ==== @@ -193,7 +193,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] Note that unlike the `custom_score` query, the score of the query is multiplied with the result of the script scoring. If @@ -251,7 +251,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] [[function-field-value-factor]] ==== Field Value factor @@ -281,7 +281,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] Which will translate into the following formula for scoring: @@ -383,7 +383,7 @@ GET /_search "query": { "function_score": { "gauss": { - "date": { + "@timestamp": { "origin": "2013-09-17", <1> "scale": "10d", "offset": "5d", <2> @@ -394,7 +394,7 @@ GET /_search } } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] <1> The date format of the origin depends on the <> defined in your mapping. If you do not define the origin, the current time is used. diff --git a/docs/reference/query-dsl/prefix-query.asciidoc b/docs/reference/query-dsl/prefix-query.asciidoc index ac44fe74411..51212ff1b7f 100644 --- a/docs/reference/query-dsl/prefix-query.asciidoc +++ b/docs/reference/query-dsl/prefix-query.asciidoc @@ -9,7 +9,7 @@ Returns documents that contain a specific prefix in a provided field. [[prefix-query-ex-request]] ==== Example request -The following search returns documents where the `user` field contains a term +The following search returns documents where the `user.id` field contains a term that begins with `ki`. [source,console] @@ -18,7 +18,7 @@ GET /_search { "query": { "prefix": { - "user": { + "user.id": { "value": "ki" } } diff --git a/docs/reference/query-dsl/query-string-syntax.asciidoc b/docs/reference/query-dsl/query-string-syntax.asciidoc index 2b1a8872c3b..52c9030acb2 100644 --- a/docs/reference/query-dsl/query-string-syntax.asciidoc +++ b/docs/reference/query-dsl/query-string-syntax.asciidoc @@ -292,17 +292,17 @@ need to write your query as `\(1\+1\)\=2`. When using JSON for the request body, [source,console] ---- -GET /twitter/_search +GET /my-index-000001/_search { "query" : { "query_string" : { "query" : "kimchy\\!", - "fields" : ["user"] + "fields" : ["user.id"] } } } ---- -// TEST[setup:twitter] +// TEST[setup:my_index] The reserved characters are: `+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /` diff --git a/docs/reference/query-dsl/regexp-query.asciidoc b/docs/reference/query-dsl/regexp-query.asciidoc index df629d204e3..0e2d0a2664d 100644 --- a/docs/reference/query-dsl/regexp-query.asciidoc +++ b/docs/reference/query-dsl/regexp-query.asciidoc @@ -14,7 +14,7 @@ characters, called operators. For a list of operators supported by the [[regexp-query-ex-request]] ==== Example request -The following search returns documents where the `user` field contains any term +The following search returns documents where the `user.id` field contains any term that begins with `k` and ends with `y`. The `.*` operators match any characters of any length, including no characters. Matching terms can include `ky`, `kay`, and `kimchy`. @@ -25,7 +25,7 @@ GET /_search { "query": { "regexp": { - "user": { + "user.id": { "value": "k.*y", "flags": "ALL", "max_determinized_states": 10000, diff --git a/docs/reference/query-dsl/span-first-query.asciidoc b/docs/reference/query-dsl/span-first-query.asciidoc index 152a646ea2f..77e3f557fd9 100644 --- a/docs/reference/query-dsl/span-first-query.asciidoc +++ b/docs/reference/query-dsl/span-first-query.asciidoc @@ -14,7 +14,7 @@ GET /_search "query": { "span_first": { "match": { - "span_term": { "user": "kimchy" } + "span_term": { "user.id": "kimchy" } }, "end": 3 } diff --git a/docs/reference/query-dsl/span-term-query.asciidoc b/docs/reference/query-dsl/span-term-query.asciidoc index 647e96bad0f..0dac73c9f70 100644 --- a/docs/reference/query-dsl/span-term-query.asciidoc +++ b/docs/reference/query-dsl/span-term-query.asciidoc @@ -12,7 +12,7 @@ Matches spans containing a term. The span term query maps to Lucene GET /_search { "query": { - "span_term" : { "user" : "kimchy" } + "span_term" : { "user.id" : "kimchy" } } } -------------------------------------------------- @@ -24,7 +24,7 @@ A boost can also be associated with the query: GET /_search { "query": { - "span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } } + "span_term" : { "user.id" : { "value" : "kimchy", "boost" : 2.0 } } } } -------------------------------------------------- @@ -36,7 +36,7 @@ Or : GET /_search { "query": { - "span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } } + "span_term" : { "user.id" : { "term" : "kimchy", "boost" : 2.0 } } } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/term-query.asciidoc b/docs/reference/query-dsl/term-query.asciidoc index 11dc91acc0f..1e96d15f6de 100644 --- a/docs/reference/query-dsl/term-query.asciidoc +++ b/docs/reference/query-dsl/term-query.asciidoc @@ -30,8 +30,8 @@ GET /_search { "query": { "term": { - "user": { - "value": "Kimchy", + "user.id": { + "value": "kimchy", "boost": 1.0 } } diff --git a/docs/reference/query-dsl/terms-query.asciidoc b/docs/reference/query-dsl/terms-query.asciidoc index 462f1c2a6e2..a39fa5c0b0f 100644 --- a/docs/reference/query-dsl/terms-query.asciidoc +++ b/docs/reference/query-dsl/terms-query.asciidoc @@ -12,8 +12,8 @@ except you can search for multiple values. [[terms-query-ex-request]] ==== Example request -The following search returns documents where the `user` field contains `kimchy` -or `elasticsearch`. +The following search returns documents where the `user.id` field contains `kimchy` +or `elkbee`. [source,console] ---- @@ -21,7 +21,7 @@ GET /_search { "query": { "terms": { - "user": [ "kimchy", "elasticsearch" ], + "user.id": [ "kimchy", "elkbee" ], "boost": 1.0 } } diff --git a/docs/reference/query-dsl/wildcard-query.asciidoc b/docs/reference/query-dsl/wildcard-query.asciidoc index d1c11031e59..215066dda74 100644 --- a/docs/reference/query-dsl/wildcard-query.asciidoc +++ b/docs/reference/query-dsl/wildcard-query.asciidoc @@ -13,7 +13,7 @@ combine wildcard operators with other characters to create a wildcard pattern. [[wildcard-query-ex-request]] ==== Example request -The following search returns documents where the `user` field contains a term +The following search returns documents where the `user.id` field contains a term that begins with `ki` and ends with `y`. These matching terms can include `kiy`, `kity`, or `kimchy`. @@ -23,7 +23,7 @@ GET /_search { "query": { "wildcard": { - "user": { + "user.id": { "value": "ki*y", "boost": 1.0, "rewrite": "constant_score" diff --git a/docs/reference/query-dsl/wrapper-query.asciidoc b/docs/reference/query-dsl/wrapper-query.asciidoc index 58191be4de0..b8b9626202e 100644 --- a/docs/reference/query-dsl/wrapper-query.asciidoc +++ b/docs/reference/query-dsl/wrapper-query.asciidoc @@ -12,13 +12,13 @@ GET /_search { "query": { "wrapper": { - "query": "eyJ0ZXJtIiA6IHsgInVzZXIiIDogIktpbWNoeSIgfX0=" <1> + "query": "eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0=" <1> } } } -------------------------------------------------- -<1> Base64 encoded string: `{"term" : { "user" : "Kimchy" }}` +<1> Base64 encoded string: `{"term" : { "user.id" : "kimchy" }}` This query is more useful in the context of the Java high-level REST client or transport client to also accept queries as json formatted string. diff --git a/docs/reference/scripting/using.asciidoc b/docs/reference/scripting/using.asciidoc index 80ecc2c0a4c..3c912593b8c 100644 --- a/docs/reference/scripting/using.asciidoc +++ b/docs/reference/scripting/using.asciidoc @@ -163,7 +163,7 @@ POST _scripts/calculate-score } } ----------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] You may also specify a context as part of the url path to compile a stored script against that specific context in the form of @@ -179,7 +179,7 @@ POST _scripts/calculate-score/score } } ----------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] This same script can be retrieved with: @@ -193,7 +193,7 @@ Stored scripts can be used by specifying the `id` parameters as follows: [source,console] -------------------------------------------------- -GET twitter/_search +GET my-index-000001/_search { "query": { "script_score": { diff --git a/docs/reference/search.asciidoc b/docs/reference/search.asciidoc index 97e5eeed8dc..e360e12d4df 100644 --- a/docs/reference/search.asciidoc +++ b/docs/reference/search.asciidoc @@ -11,26 +11,28 @@ exception of the <> endpoints. When executing a search, Elasticsearch will pick the "best" copy of the data based on the <> formula. Which shards will be searched on can also be controlled by providing the -`routing` parameter. For example, when indexing tweets, the routing value can be -the user name: +`routing` parameter. + +For example, the following indexing request routes documents to shard `1`: [source,console] -------------------------------------------------- -POST /twitter/_doc?routing=kimchy +POST /my-index-000001/_doc?routing=1 { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "@timestamp": "2099-11-15T13:12:00", + "message": "GET /search HTTP/1.1 200 1070000", + "user": { + "id": "kimchy" + } } -------------------------------------------------- -In such a case, if we want to search only on the tweets for a specific -user, we can specify it as the routing, resulting in the search hitting -only the relevant shard: +Later, you can use the `routing` parameter in a search request to search only +the specified shard. The following search requests hits only shard `1`. [source,console] -------------------------------------------------- -POST /twitter/_search?routing=kimchy +POST /my-index-000001/_search?routing=1 { "query": { "bool": { @@ -40,7 +42,7 @@ POST /twitter/_search?routing=kimchy } }, "filter": { - "term": { "user": "kimchy" } + "term": { "user.id": "kimchy" } } } } @@ -102,7 +104,7 @@ POST /_search "stats" : ["group1", "group2"] } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] [discrete] [[global-search-timeout]]