diff --git a/docs/reference/cluster/health.asciidoc b/docs/reference/cluster/health.asciidoc index 767bc9b8f1c6..869a72e7f49e 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 5cd77764b030..c3cdf95a6238 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 e2d623cb9b19..32e73c757b72 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 aac13128d101..ec7218446235 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 55e63027fc73..873f09fcb67e 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-000001/_eql/search { "query": """ - file where (file.name == "cmd.exe" and agent.id != "my_user") + file where (file.name == "cmd.exe" and agent.id != "8a4f526c") """ } ---- @@ -614,7 +614,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: + @@ -631,7 +631,7 @@ GET /my-index-000001/_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 5a2ef125a8cc..3c634341ff3f 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 da4297cf2259..d54b8f7e9be5 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 6cedcbee4f01..e32684c8264d 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 4efd23e59f5d..0c1743c71db1 100644 --- a/docs/reference/index-modules/slowlog.asciidoc +++ b/docs/reference/index-modules/slowlog.asciidoc @@ -29,7 +29,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", @@ -41,7 +41,7 @@ PUT /twitter/_settings "index.search.slowlog.threshold.fetch.trace": "200ms" } -------------------------------------------------- -// TEST[setup:twitter] +// TEST[setup:my_index] By default thresholds are disabled (set to `-1`). @@ -108,7 +108,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", @@ -117,7 +117,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 935a2bbf9069..0f9351daed6a 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 2d0b71fbdc60..9c3441582ee9 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 cd965619ad1d..4d29734ebf52 100644 --- a/docs/reference/indices/create-index.asciidoc +++ b/docs/reference/indices/create-index.asciidoc @@ -149,7 +149,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 73748444acc1..c5c48cb521fa 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 da0ec904f7c6..4085433db4ef 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 013c94c9f2c0..5f84c1e15272 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 270d62076c16..f677986fccce 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 8276c9c9f96d..fa32b7bad2ef 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 38e71158512b..98c64614a26d 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,13 +109,20 @@ The API returns the following response: "max_score": 1, "hits": [ { - "_index": "cluster_one:twitter", <1> + "_index": "cluster_one:my-index-000001", <1> "_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 + } + } } } ] @@ -133,7 +140,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 @@ -141,14 +148,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] @@ -180,33 +187,54 @@ The API returns the following response: "max_score": 1, "hits": [ { - "_index": "twitter", <1> + "_index": "my-index-000001", <1> "_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> "_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> "_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 6dc900ecb7b6..6208f09bf083 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 8477d9115ba3..15c7f047d328 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 ac44fe74411a..51212ff1b7f4 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 2b1a8872c3b9..52c9030acb27 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 df629d204e3d..0e2d0a2664da 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 152a646ea2f6..77e3f557fd98 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 647e96bad0f2..0dac73c9f701 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 d3b6e2401af3..c11a0c34a4a8 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 2ade7b22c96c..90854bcf3205 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 d1c11031e590..215066dda74a 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 58191be4de0e..b8b9626202e7 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 312e0861700d..5e9499f35c1c 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 97e5eeed8dcc..e360e12d4df8 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]]