diff --git a/README.asciidoc b/README.asciidoc index 73bdba5a359..94a0588efd8 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -45,23 +45,23 @@ Let's try and index some twitter like information. First, let's index some tweet ---- curl -XPUT 'http://localhost:9200/twitter/_doc/1?pretty' -H 'Content-Type: application/json' -d ' { - "user": "kimchy", - "post_date": "2009-11-15T13:12:00", - "message": "Trying out Elasticsearch, so far so good?" + "user": "kimchy", + "post_date": "2009-11-15T13:12:00", + "message": "Trying out Elasticsearch, so far so good?" }' curl -XPUT 'http://localhost:9200/twitter/_doc/2?pretty' -H 'Content-Type: application/json' -d ' { - "user": "kimchy", - "post_date": "2009-11-15T14:12:12", - "message": "Another tweet, will it be indexed?" + "user": "kimchy", + "post_date": "2009-11-15T14:12:12", + "message": "Another tweet, will it be indexed?" }' curl -XPUT 'http://localhost:9200/twitter/_doc/3?pretty' -H 'Content-Type: application/json' -d ' { - "user": "elastic", - "post_date": "2010-01-15T01:46:38", - "message": "Building the site, should be kewl" + "user": "elastic", + "post_date": "2010-01-15T01:46:38", + "message": "Building the site, should be kewl" }' ---- @@ -87,9 +87,9 @@ We can also use the JSON query language Elasticsearch provides instead of a quer ---- curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d ' { - "query" : { - "match" : { "user": "kimchy" } - } + "query" : { + "match" : { "user": "kimchy" } + } }' ---- @@ -98,9 +98,9 @@ Just for kicks, let's get all the documents stored (we should see the tweet from ---- curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d ' { - "query" : { - "match_all" : {} - } + "query" : { + "match_all" : {} + } }' ---- @@ -109,11 +109,11 @@ We can also do range search (the `post_date` was automatically identified as dat ---- curl -XGET 'http://localhost:9200/twitter/_search?pretty=true' -H 'Content-Type: application/json' -d ' { - "query" : { - "range" : { - "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" } - } + "query" : { + "range" : { + "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:00:00" } } + } }' ---- @@ -130,16 +130,16 @@ Another way to define our simple twitter system is to have a different index per ---- curl -XPUT 'http://localhost:9200/kimchy/_doc/1?pretty' -H 'Content-Type: application/json' -d ' { - "user": "kimchy", - "post_date": "2009-11-15T13:12:00", - "message": "Trying out Elasticsearch, so far so good?" + "user": "kimchy", + "post_date": "2009-11-15T13:12:00", + "message": "Trying out Elasticsearch, so far so good?" }' curl -XPUT 'http://localhost:9200/kimchy/_doc/2?pretty' -H 'Content-Type: application/json' -d ' { - "user": "kimchy", - "post_date": "2009-11-15T14:12:12", - "message": "Another tweet, will it be indexed?" + "user": "kimchy", + "post_date": "2009-11-15T14:12:12", + "message": "Another tweet, will it be indexed?" }' ---- @@ -150,10 +150,10 @@ Complete control on the index level is allowed. As an example, in the above case ---- curl -XPUT http://localhost:9200/another_user?pretty -H 'Content-Type: application/json' -d ' { - "settings" : { - "index.number_of_shards" : 2, - "index.number_of_replicas" : 1 - } + "settings" : { + "index.number_of_shards" : 2, + "index.number_of_replicas" : 1 + } }' ---- @@ -163,9 +163,9 @@ index (twitter user), for example: ---- curl -XGET 'http://localhost:9200/kimchy,another_user/_search?pretty=true' -H 'Content-Type: application/json' -d ' { - "query" : { - "match_all" : {} - } + "query" : { + "match_all" : {} + } }' ---- @@ -174,9 +174,9 @@ Or on all the indices: ---- curl -XGET 'http://localhost:9200/_search?pretty=true' -H 'Content-Type: application/json' -d ' { - "query" : { - "match_all" : {} - } + "query" : { + "match_all" : {} + } }' ---- diff --git a/docs/reference/analysis/tokenfilters/_token-filter-template.asciidoc b/docs/reference/analysis/tokenfilters/_token-filter-template.asciidoc index 3cace3136d7..ea5b040a479 100644 --- a/docs/reference/analysis/tokenfilters/_token-filter-template.asciidoc +++ b/docs/reference/analysis/tokenfilters/_token-filter-template.asciidoc @@ -145,16 +145,16 @@ The following <> request uses the ---- PUT sample_example { - "settings" : { - "analysis" : { - "analyzer" : { - "my_sample_analyzer" : { - "tokenizer" : "standard", - "filter" : ["sample"] - } - } + "settings": { + "analysis": { + "analyzer": { + "my_sample_analyzer": { + "tokenizer": "standard", + "filter": [ "sample" ] } + } } + } } ---- // TEST[skip: REMOVE THIS COMMENT.] @@ -212,22 +212,22 @@ For example, the following request creates a custom `sample` filter with ---- PUT sample_example { - "settings" : { - "analysis" : { - "analyzer" : { - "my_custom_analyzer" : { - "tokenizer" : "whitespace", - "filter" : ["my_custom_sample_token_filter"] - } - }, - "filter" : { - "my_custom_sample_token_filter" : { - "type" : "sample", - "foo" : true - } - } + "settings": { + "analysis": { + "analyzer": { + "my_custom_analyzer": { + "tokenizer": "whitespace", + "filter": [ "my_custom_sample_token_filter" ] } + }, + "filter": { + "my_custom_sample_token_filter": { + "type": "sample", + "foo": true + } + } } + } } ---- // TEST[skip: REMOVE THIS COMMENT.] diff --git a/docs/reference/analysis/tokenfilters/apostrophe-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/apostrophe-tokenfilter.asciidoc index 228feeca34b..49c75e47af0 100644 --- a/docs/reference/analysis/tokenfilters/apostrophe-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/apostrophe-tokenfilter.asciidoc @@ -77,15 +77,15 @@ apostrophe token filter to configure a new -------------------------------------------------- PUT /apostrophe_example { - "settings" : { - "analysis" : { - "analyzer" : { - "standard_apostrophe" : { - "tokenizer" : "standard", - "filter" : ["apostrophe"] - } - } + "settings": { + "analysis": { + "analyzer": { + "standard_apostrophe": { + "tokenizer": "standard", + "filter": [ "apostrophe" ] } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc index 80b1821c1e5..777acc4dd52 100644 --- a/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/asciifolding-tokenfilter.asciidoc @@ -83,16 +83,16 @@ The following <> request uses the -------------------------------------------------- PUT /asciifold_example { - "settings" : { - "analysis" : { - "analyzer" : { - "standard_asciifolding" : { - "tokenizer" : "standard", - "filter" : ["asciifolding"] - } - } + "settings": { + "analysis": { + "analyzer": { + "standard_asciifolding": { + "tokenizer": "standard", + "filter": [ "asciifolding" ] } + } } + } } -------------------------------------------------- @@ -118,21 +118,21 @@ For example, the following request creates a custom `asciifolding` filter with -------------------------------------------------- PUT /asciifold_example { - "settings" : { - "analysis" : { - "analyzer" : { - "standard_asciifolding" : { - "tokenizer" : "standard", - "filter" : ["my_ascii_folding"] - } - }, - "filter" : { - "my_ascii_folding" : { - "type" : "asciifolding", - "preserve_original" : true - } - } + "settings": { + "analysis": { + "analyzer": { + "standard_asciifolding": { + "tokenizer": "standard", + "filter": [ "my_ascii_folding" ] } + }, + "filter": { + "my_ascii_folding": { + "type": "asciifolding", + "preserve_original": true + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc index 9a6f80352f6..f828b02c134 100644 --- a/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/cjk-bigram-tokenfilter.asciidoc @@ -126,16 +126,16 @@ CJK bigram token filter to configure a new -------------------------------------------------- PUT /cjk_bigram_example { - "settings" : { - "analysis" : { - "analyzer" : { - "standard_cjk_bigram" : { - "tokenizer" : "standard", - "filter" : ["cjk_bigram"] - } - } + "settings": { + "analysis": { + "analyzer": { + "standard_cjk_bigram": { + "tokenizer": "standard", + "filter": [ "cjk_bigram" ] } + } } + } } -------------------------------------------------- @@ -176,26 +176,26 @@ parameters. -------------------------------------------------- PUT /cjk_bigram_example { - "settings" : { - "analysis" : { - "analyzer" : { - "han_bigrams" : { - "tokenizer" : "standard", - "filter" : ["han_bigrams_filter"] - } - }, - "filter" : { - "han_bigrams_filter" : { - "type" : "cjk_bigram", - "ignored_scripts": [ - "hangul", - "hiragana", - "katakana" - ], - "output_unigrams" : true - } - } + "settings": { + "analysis": { + "analyzer": { + "han_bigrams": { + "tokenizer": "standard", + "filter": [ "han_bigrams_filter" ] } + }, + "filter": { + "han_bigrams_filter": { + "type": "cjk_bigram", + "ignored_scripts": [ + "hangul", + "hiragana", + "katakana" + ], + "output_unigrams": true + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/cjk-width-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/cjk-width-tokenfilter.asciidoc index a41e994c35b..e055d1783d4 100644 --- a/docs/reference/analysis/tokenfilters/cjk-width-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/cjk-width-tokenfilter.asciidoc @@ -69,15 +69,15 @@ CJK width token filter to configure a new -------------------------------------------------- PUT /cjk_width_example { - "settings" : { - "analysis" : { - "analyzer" : { - "standard_cjk_width" : { - "tokenizer" : "standard", - "filter" : ["cjk_width"] - } - } + "settings": { + "analysis": { + "analyzer": { + "standard_cjk_width": { + "tokenizer": "standard", + "filter": [ "cjk_width" ] } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/classic-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/classic-tokenfilter.asciidoc index 4f25b6da3cc..8bab797a750 100644 --- a/docs/reference/analysis/tokenfilters/classic-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/classic-tokenfilter.asciidoc @@ -132,16 +132,16 @@ classic token filter to configure a new -------------------------------------------------- PUT /classic_example { - "settings" : { - "analysis" : { - "analyzer" : { - "classic_analyzer" : { - "tokenizer" : "classic", - "filter" : ["classic"] - } - } + "settings": { + "analysis": { + "analyzer": { + "classic_analyzer": { + "tokenizer": "classic", + "filter": [ "classic" ] } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc index e2b0a57d3df..d51ff62e780 100644 --- a/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/common-grams-tokenfilter.asciidoc @@ -126,22 +126,22 @@ The following <> request uses the -------------------------------------------------- PUT /common_grams_example { - "settings": { - "analysis": { - "analyzer": { - "index_grams": { - "tokenizer": "whitespace", - "filter": ["common_grams"] - } - }, - "filter": { - "common_grams": { - "type": "common_grams", - "common_words": ["a", "is", "the"] - } - } + "settings": { + "analysis": { + "analyzer": { + "index_grams": { + "tokenizer": "whitespace", + "filter": [ "common_grams" ] } + }, + "filter": { + "common_grams": { + "type": "common_grams", + "common_words": [ "a", "is", "the" ] + } + } } + } } -------------------------------------------------- @@ -206,23 +206,23 @@ For example, the following request creates a custom `common_grams` filter with -------------------------------------------------- PUT /common_grams_example { - "settings": { - "analysis": { - "analyzer": { - "index_grams": { - "tokenizer": "whitespace", - "filter": ["common_grams_query"] - } - }, - "filter": { - "common_grams_query": { - "type": "common_grams", - "common_words": ["a", "is", "the"], - "ignore_case": true, - "query_mode": true - } - } + "settings": { + "analysis": { + "analyzer": { + "index_grams": { + "tokenizer": "whitespace", + "filter": [ "common_grams_query" ] } + }, + "filter": { + "common_grams_query": { + "type": "common_grams", + "common_words": [ "a", "is", "the" ], + "ignore_case": true, + "query_mode": true + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/decimal-digit-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/decimal-digit-tokenfilter.asciidoc index 76d085cf4b0..6436bad8ac3 100644 --- a/docs/reference/analysis/tokenfilters/decimal-digit-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/decimal-digit-tokenfilter.asciidoc @@ -75,15 +75,15 @@ The following <> request uses the -------------------------------------------------- PUT /decimal_digit_example { - "settings" : { - "analysis" : { - "analyzer" : { - "whitespace_decimal_digit" : { - "tokenizer" : "whitespace", - "filter" : ["decimal_digit"] - } - } + "settings": { + "analysis": { + "analyzer": { + "whitespace_decimal_digit": { + "tokenizer": "whitespace", + "filter": [ "decimal_digit" ] } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc index fd3e1124552..96ead5bc616 100644 --- a/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/elision-tokenfilter.asciidoc @@ -96,16 +96,16 @@ The following <> request uses the -------------------------------------------------- PUT /elision_example { - "settings" : { - "analysis" : { - "analyzer" : { - "whitespace_elision" : { - "tokenizer" : "whitespace", - "filter" : ["elision"] - } - } + "settings": { + "analysis": { + "analyzer": { + "whitespace_elision": { + "tokenizer": "whitespace", + "filter": [ "elision" ] } + } } + } } -------------------------------------------------- @@ -165,22 +165,22 @@ and `j'` elisions: -------------------------------------------------- PUT /elision_case_sensitive_example { - "settings" : { - "analysis" : { - "analyzer" : { - "default" : { - "tokenizer" : "whitespace", - "filter" : ["elision_case_sensitive"] - } - }, - "filter" : { - "elision_case_sensitive" : { - "type" : "elision", - "articles" : ["l", "m", "t", "qu", "n", "s", "j"], - "articles_case": true - } - } + "settings": { + "analysis": { + "analyzer": { + "default": { + "tokenizer": "whitespace", + "filter": [ "elision_case_sensitive" ] } + }, + "filter": { + "elision_case_sensitive": { + "type": "elision", + "articles": [ "l", "m", "t", "qu", "n", "s", "j" ], + "articles_case": true + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc index 9b39b8ed771..f829b6f4e97 100644 --- a/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/lowercase-tokenfilter.asciidoc @@ -82,16 +82,16 @@ The following <> request uses the -------------------------------------------------- PUT lowercase_example { - "settings" : { - "analysis" : { - "analyzer" : { - "whitespace_lowercase" : { - "tokenizer" : "whitespace", - "filter" : ["lowercase"] - } - } + "settings": { + "analysis": { + "analyzer": { + "whitespace_lowercase": { + "tokenizer": "whitespace", + "filter": [ "lowercase" ] } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc index e12fa993242..41e757e5f91 100644 --- a/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/multiplexer-tokenfilter.asciidoc @@ -36,22 +36,22 @@ You can set it up like: -------------------------------------------------- PUT /multiplexer_example { - "settings" : { - "analysis" : { - "analyzer" : { - "my_analyzer" : { - "tokenizer" : "standard", - "filter" : [ "my_multiplexer" ] - } - }, - "filter" : { - "my_multiplexer" : { - "type" : "multiplexer", - "filters" : [ "lowercase", "lowercase, porter_stem" ] - } - } + "settings": { + "analysis": { + "analyzer": { + "my_analyzer": { + "tokenizer": "standard", + "filter": [ "my_multiplexer" ] } + }, + "filter": { + "my_multiplexer": { + "type": "multiplexer", + "filters": [ "lowercase", "lowercase, porter_stem" ] + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc index df1df3a43cb..303f8338515 100644 --- a/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/snowball-tokenfilter.asciidoc @@ -17,21 +17,21 @@ For example: -------------------------------------------------- PUT /my_index { - "settings": { - "analysis" : { - "analyzer" : { - "my_analyzer" : { - "tokenizer" : "standard", - "filter" : ["lowercase", "my_snow"] - } - }, - "filter" : { - "my_snow" : { - "type" : "snowball", - "language" : "Lovins" - } - } + "settings": { + "analysis": { + "analyzer": { + "my_analyzer": { + "tokenizer": "standard", + "filter": [ "lowercase", "my_snow" ] } + }, + "filter": { + "my_snow": { + "type": "snowball", + "language": "Lovins" + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc index bd4f21d7645..54d428e7be9 100644 --- a/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/stemmer-override-tokenfilter.asciidoc @@ -25,22 +25,22 @@ Here is an example: -------------------------------------------------- PUT /my_index { - "settings": { - "analysis" : { - "analyzer" : { - "my_analyzer" : { - "tokenizer" : "standard", - "filter" : ["lowercase", "custom_stems", "porter_stem"] - } - }, - "filter" : { - "custom_stems" : { - "type" : "stemmer_override", - "rules_path" : "analysis/stemmer_override.txt" - } - } + "settings": { + "analysis": { + "analyzer": { + "my_analyzer": { + "tokenizer": "standard", + "filter": [ "lowercase", "custom_stems", "porter_stem" ] } + }, + "filter": { + "custom_stems": { + "type": "stemmer_override", + "rules_path": "analysis/stemmer_override.txt" + } + } } + } } -------------------------------------------------- @@ -57,24 +57,24 @@ You can also define the overrides rules inline: -------------------------------------------------- PUT /my_index { - "settings": { - "analysis" : { - "analyzer" : { - "my_analyzer" : { - "tokenizer" : "standard", - "filter" : ["lowercase", "custom_stems", "porter_stem"] - } - }, - "filter" : { - "custom_stems" : { - "type" : "stemmer_override", - "rules" : [ - "running, runs => run", - "stemmer => stemmer" - ] - } - } + "settings": { + "analysis": { + "analyzer": { + "my_analyzer": { + "tokenizer": "standard", + "filter": [ "lowercase", "custom_stems", "porter_stem" ] } + }, + "filter": { + "custom_stems": { + "type": "stemmer_override", + "rules": [ + "running, runs => run", + "stemmer => stemmer" + ] + } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc index 582ce99b20b..778769a3233 100644 --- a/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/synonym-graph-tokenfilter.asciidoc @@ -26,24 +26,24 @@ Here is an example: -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "analyzer" : { - "search_synonyms" : { - "tokenizer" : "whitespace", - "filter" : ["graph_synonyms"] - } - }, - "filter" : { - "graph_synonyms" : { - "type" : "synonym_graph", - "synonyms_path" : "analysis/synonym.txt" - } - } - } + "settings": { + "index": { + "analysis": { + "analyzer": { + "search_synonyms": { + "tokenizer": "whitespace", + "filter": [ "graph_synonyms" ] + } + }, + "filter": { + "graph_synonyms": { + "type": "synonym_graph", + "synonyms_path": "analysis/synonym.txt" + } } + } } + } } -------------------------------------------------- @@ -61,29 +61,29 @@ to note that only those synonym rules which cannot get parsed are ignored. For i -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "analyzer" : { - "synonym" : { - "tokenizer" : "standard", - "filter" : ["my_stop", "synonym_graph"] - } - }, - "filter" : { - "my_stop": { - "type" : "stop", - "stopwords": ["bar"] - }, - "synonym_graph" : { - "type" : "synonym_graph", - "lenient": true, - "synonyms" : ["foo, bar => baz"] - } - } - } + "settings": { + "index": { + "analysis": { + "analyzer": { + "synonym": { + "tokenizer": "standard", + "filter": [ "my_stop", "synonym_graph" ] + } + }, + "filter": { + "my_stop": { + "type": "stop", + "stopwords": [ "bar" ] + }, + "synonym_graph": { + "type": "synonym_graph", + "lenient": true, + "synonyms": [ "foo, bar => baz" ] + } } + } } + } } -------------------------------------------------- @@ -121,21 +121,21 @@ configuration file (note use of `synonyms` instead of `synonyms_path`): -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "filter" : { - "synonym" : { - "type" : "synonym_graph", - "synonyms" : [ - "lol, laughing out loud", - "universe, cosmos" - ] - } - } - } + "settings": { + "index": { + "analysis": { + "filter": { + "synonym": { + "type": "synonym_graph", + "synonyms": [ + "lol, laughing out loud", + "universe, cosmos" + ] + } } + } } + } } -------------------------------------------------- @@ -152,23 +152,23 @@ declared using `format`: -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "filter" : { - "synonym" : { - "type" : "synonym_graph", - "format" : "wordnet", - "synonyms" : [ - "s(100000001,1,'abstain',v,1,0).", - "s(100000001,2,'refrain',v,1,0).", - "s(100000001,3,'desist',v,1,0)." - ] - } - } - } + "settings": { + "index": { + "analysis": { + "filter": { + "synonym": { + "type": "synonym_graph", + "format": "wordnet", + "synonyms": [ + "s(100000001,1,'abstain',v,1,0).", + "s(100000001,2,'refrain',v,1,0).", + "s(100000001,3,'desist',v,1,0)." + ] + } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc index 5d4b736501c..f42ae89daab 100644 --- a/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/synonym-tokenfilter.asciidoc @@ -12,24 +12,24 @@ Here is an example: -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "analyzer" : { - "synonym" : { - "tokenizer" : "whitespace", - "filter" : ["synonym"] - } - }, - "filter" : { - "synonym" : { - "type" : "synonym", - "synonyms_path" : "analysis/synonym.txt" - } - } - } + "settings": { + "index": { + "analysis": { + "analyzer": { + "synonym": { + "tokenizer": "whitespace", + "filter": [ "synonym" ] + } + }, + "filter": { + "synonym": { + "type": "synonym", + "synonyms_path": "analysis/synonym.txt" + } } + } } + } } -------------------------------------------------- @@ -51,29 +51,29 @@ to note that only those synonym rules which cannot get parsed are ignored. For i -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "analyzer" : { - "synonym" : { - "tokenizer" : "standard", - "filter" : ["my_stop", "synonym"] - } - }, - "filter" : { - "my_stop": { - "type" : "stop", - "stopwords": ["bar"] - }, - "synonym" : { - "type" : "synonym", - "lenient": true, - "synonyms" : ["foo, bar => baz"] - } - } - } + "settings": { + "index": { + "analysis": { + "analyzer": { + "synonym": { + "tokenizer": "standard", + "filter": [ "my_stop", "synonym" ] + } + }, + "filter": { + "my_stop": { + "type": "stop", + "stopwords": [ "bar" ] + }, + "synonym": { + "type": "synonym", + "lenient": true, + "synonyms": [ "foo, bar => baz" ] + } } + } } + } } -------------------------------------------------- @@ -112,21 +112,21 @@ configuration file (note use of `synonyms` instead of `synonyms_path`): -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "filter" : { - "synonym" : { - "type" : "synonym", - "synonyms" : [ - "i-pod, i pod => ipod", - "universe, cosmos" - ] - } - } - } + "settings": { + "index": { + "analysis": { + "filter": { + "synonym": { + "type": "synonym", + "synonyms": [ + "i-pod, i pod => ipod", + "universe, cosmos" + ] + } } + } } + } } -------------------------------------------------- @@ -143,23 +143,23 @@ declared using `format`: -------------------------------------------------- PUT /test_index { - "settings": { - "index" : { - "analysis" : { - "filter" : { - "synonym" : { - "type" : "synonym", - "format" : "wordnet", - "synonyms" : [ - "s(100000001,1,'abstain',v,1,0).", - "s(100000001,2,'refrain',v,1,0).", - "s(100000001,3,'desist',v,1,0)." - ] - } - } - } + "settings": { + "index": { + "analysis": { + "filter": { + "synonym": { + "type": "synonym", + "format": "wordnet", + "synonyms": [ + "s(100000001,1,'abstain',v,1,0).", + "s(100000001,2,'refrain',v,1,0).", + "s(100000001,3,'desist',v,1,0)." + ] + } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/analysis/tokenfilters/uppercase-tokenfilter.asciidoc b/docs/reference/analysis/tokenfilters/uppercase-tokenfilter.asciidoc index 84c9ebd1865..9192a46810a 100644 --- a/docs/reference/analysis/tokenfilters/uppercase-tokenfilter.asciidoc +++ b/docs/reference/analysis/tokenfilters/uppercase-tokenfilter.asciidoc @@ -92,15 +92,15 @@ The following <> request uses the -------------------------------------------------- PUT uppercase_example { - "settings" : { - "analysis" : { - "analyzer" : { - "whitespace_uppercase" : { - "tokenizer" : "whitespace", - "filter" : ["uppercase"] - } - } + "settings": { + "analysis": { + "analyzer": { + "whitespace_uppercase": { + "tokenizer": "whitespace", + "filter": [ "uppercase" ] } + } } + } } -------------------------------------------------- diff --git a/docs/reference/ccr/apis/follow/get-follow-info.asciidoc b/docs/reference/ccr/apis/follow/get-follow-info.asciidoc index 0cf815d69af..f98cf0f281a 100644 --- a/docs/reference/ccr/apis/follow/get-follow-info.asciidoc +++ b/docs/reference/ccr/apis/follow/get-follow-info.asciidoc @@ -145,26 +145,26 @@ If the follower index is `active`, the API returns the following results: [source,console-result] -------------------------------------------------- { - "follower_indices" : [ - { - "follower_index" : "follower_index", - "remote_cluster" : "remote_cluster", - "leader_index" : "leader_index", - "status" : "active", - "parameters" : { - "max_read_request_operation_count" : 5120, - "max_read_request_size" : "32mb", - "max_outstanding_read_requests" : 12, - "max_write_request_operation_count" : 5120, - "max_write_request_size" : "9223372036854775807b", - "max_outstanding_write_requests" : 9, - "max_write_buffer_count" : 2147483647, - "max_write_buffer_size" : "512mb", - "max_retry_delay" : "500ms", - "read_poll_timeout" : "1m" - } - } - ] + "follower_indices": [ + { + "follower_index": "follower_index", + "remote_cluster": "remote_cluster", + "leader_index": "leader_index", + "status": "active", + "parameters": { + "max_read_request_operation_count": 5120, + "max_read_request_size": "32mb", + "max_outstanding_read_requests": 12, + "max_write_request_operation_count": 5120, + "max_write_request_size": "9223372036854775807b", + "max_outstanding_write_requests": 9, + "max_write_buffer_count": 2147483647, + "max_write_buffer_size": "512mb", + "max_retry_delay": "500ms", + "read_poll_timeout": "1m" + } + } + ] } -------------------------------------------------- @@ -187,13 +187,13 @@ If the follower index is `paused`, the API returns the following results: [source,console-result] -------------------------------------------------- { - "follower_indices" : [ - { - "follower_index" : "follower_index", - "remote_cluster" : "remote_cluster", - "leader_index" : "leader_index", - "status" : "paused" - } - ] + "follower_indices": [ + { + "follower_index": "follower_index", + "remote_cluster": "remote_cluster", + "leader_index": "leader_index", + "status": "paused" + } + ] } -------------------------------------------------- diff --git a/docs/reference/cluster/reroute.asciidoc b/docs/reference/cluster/reroute.asciidoc index b61d30181fb..1a64e6e0920 100644 --- a/docs/reference/cluster/reroute.asciidoc +++ b/docs/reference/cluster/reroute.asciidoc @@ -185,20 +185,20 @@ This is a short example of a simple reroute API call: -------------------------------------------------- POST /_cluster/reroute { - "commands" : [ - { - "move" : { - "index" : "test", "shard" : 0, - "from_node" : "node1", "to_node" : "node2" - } - }, - { - "allocate_replica" : { - "index" : "test", "shard" : 1, - "node" : "node3" - } - } - ] + "commands": [ + { + "move": { + "index": "test", "shard": 0, + "from_node": "node1", "to_node": "node2" + } + }, + { + "allocate_replica": { + "index": "test", "shard": 1, + "node": "node3" + } + } + ] } -------------------------------------------------- // TEST[skip:doc tests run with only a single node] diff --git a/docs/reference/cluster/update-settings.asciidoc b/docs/reference/cluster/update-settings.asciidoc index 9ff4cebe1f2..627516884c7 100644 --- a/docs/reference/cluster/update-settings.asciidoc +++ b/docs/reference/cluster/update-settings.asciidoc @@ -62,9 +62,9 @@ An example of a persistent update: -------------------------------------------------- PUT /_cluster/settings { - "persistent" : { - "indices.recovery.max_bytes_per_sec" : "50mb" - } + "persistent" : { + "indices.recovery.max_bytes_per_sec" : "50mb" + } } -------------------------------------------------- @@ -75,9 +75,9 @@ An example of a transient update: -------------------------------------------------- PUT /_cluster/settings?flat_settings=true { - "transient" : { - "indices.recovery.max_bytes_per_sec" : "20mb" - } + "transient" : { + "indices.recovery.max_bytes_per_sec" : "20mb" + } } -------------------------------------------------- @@ -88,11 +88,11 @@ the transient example: [source,console-result] -------------------------------------------------- { - ... - "persistent" : { }, - "transient" : { - "indices.recovery.max_bytes_per_sec" : "20mb" - } + ... + "persistent" : { }, + "transient" : { + "indices.recovery.max_bytes_per_sec" : "20mb" + } } -------------------------------------------------- // TESTRESPONSE[s/\.\.\./"acknowledged": true,/] @@ -104,9 +104,9 @@ This example resets a setting: -------------------------------------------------- PUT /_cluster/settings { - "transient" : { - "indices.recovery.max_bytes_per_sec" : null - } + "transient" : { + "indices.recovery.max_bytes_per_sec" : null + } } -------------------------------------------------- @@ -116,9 +116,9 @@ The response does not include settings that have been reset: [source,console-result] -------------------------------------------------- { - ... - "persistent" : {}, - "transient" : {} + ... + "persistent" : {}, + "transient" : {} } -------------------------------------------------- // TESTRESPONSE[s/\.\.\./"acknowledged": true,/] @@ -131,8 +131,8 @@ all dynamic `indices.recovery` settings: -------------------------------------------------- PUT /_cluster/settings { - "transient" : { - "indices.recovery.*" : null - } + "transient" : { + "indices.recovery.*" : null + } } -------------------------------------------------- diff --git a/docs/reference/docs/concurrency-control.asciidoc b/docs/reference/docs/concurrency-control.asciidoc index f50adf4fadc..c399f6063ab 100644 --- a/docs/reference/docs/concurrency-control.asciidoc +++ b/docs/reference/docs/concurrency-control.asciidoc @@ -24,8 +24,8 @@ an initial sequence number and primary term: -------------------------------------------------- PUT products/_doc/1567 { - "product" : "r2d2", - "details" : "A resourceful astromech droid" + "product" : "r2d2", + "details" : "A resourceful astromech droid" } -------------------------------------------------- @@ -35,21 +35,22 @@ You can see the assigned sequence number and primary term in the [source,console-result] -------------------------------------------------- { - "_shards" : { - "total" : 2, - "failed" : 0, - "successful" : 1 - }, - "_index" : "products", - "_type" : "_doc", - "_id" : "1567", - "_version" : 1, - "_seq_no" : 362, - "_primary_term" : 2, - "result" : "created" + "_shards": { + "total": 2, + "failed": 0, + "successful": 1 + }, + "_index": "products", + "_type": "_doc", + "_id": "1567", + "_version": 1, + "_seq_no": 362, + "_primary_term": 2, + "result": "created" } -------------------------------------------------- -// TESTRESPONSE[s/"_seq_no" : \d+/"_seq_no" : $body._seq_no/ s/"_primary_term" : 2/"_primary_term" : $body._primary_term/] +// TESTRESPONSE[s/"_seq_no": 362/"_seq_no": $body._seq_no/] +// TESTRESPONSE[s/"_primary_term": 2/"_primary_term": $body._primary_term/] Elasticsearch keeps tracks of the sequence number and primary term of the last @@ -68,20 +69,21 @@ returns: [source,console-result] -------------------------------------------------- { - "_index" : "products", - "_type" : "_doc", - "_id" : "1567", - "_version" : 1, - "_seq_no" : 362, - "_primary_term" : 2, - "found": true, - "_source" : { - "product" : "r2d2", - "details" : "A resourceful astromech droid" - } + "_index": "products", + "_type": "_doc", + "_id": "1567", + "_version": 1, + "_seq_no": 362, + "_primary_term": 2, + "found": true, + "_source": { + "product": "r2d2", + "details": "A resourceful astromech droid" + } } -------------------------------------------------- -// TESTRESPONSE[s/"_seq_no" : \d+/"_seq_no" : $body._seq_no/ s/"_primary_term" : 2/"_primary_term" : $body._primary_term/] +// TESTRESPONSE[s/"_seq_no": 362/"_seq_no": $body._seq_no/] +// TESTRESPONSE[s/"_primary_term": 2/"_primary_term": $body._primary_term/] Note: The <> can return the `_seq_no` and `_primary_term` @@ -102,9 +104,9 @@ of another tag by another API: -------------------------------------------------- PUT products/_doc/1567?if_seq_no=362&if_primary_term=2 { - "product" : "r2d2", - "details" : "A resourceful astromech droid", - "tags": ["droid"] + "product": "r2d2", + "details": "A resourceful astromech droid", + "tags": [ "droid" ] } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/docs/delete.asciidoc b/docs/reference/docs/delete.asciidoc index 26a1ce19a17..7067be7aa72 100644 --- a/docs/reference/docs/delete.asciidoc +++ b/docs/reference/docs/delete.asciidoc @@ -65,7 +65,7 @@ Example to delete with routing -------------------------------------------------- PUT /twitter/_doc/1?routing=kimchy { - "test": "test" + "test": "test" } -------------------------------------------------- //// @@ -179,20 +179,20 @@ The API returns the following result: [source,console-result] -------------------------------------------------- { - "_shards" : { - "total" : 2, - "failed" : 0, - "successful" : 2 - }, - "_index" : "twitter", - "_type" : "_doc", - "_id" : "1", - "_version" : 2, - "_primary_term": 1, - "_seq_no": 5, - "result": "deleted" + "_shards": { + "total": 2, + "failed": 0, + "successful": 2 + }, + "_index": "twitter", + "_type": "_doc", + "_id": "1", + "_version": 2, + "_primary_term": 1, + "_seq_no": 5, + "result": "deleted" } -------------------------------------------------- -// TESTRESPONSE[s/"successful" : 2/"successful" : 1/] -// TESTRESPONSE[s/"_primary_term" : 1/"_primary_term" : $body._primary_term/] -// TESTRESPONSE[s/"_seq_no" : 5/"_seq_no" : $body._seq_no/] +// TESTRESPONSE[s/"successful": 2/"successful": 1/] +// TESTRESPONSE[s/"_primary_term": 1/"_primary_term": $body._primary_term/] +// TESTRESPONSE[s/"_seq_no": 5/"_seq_no": $body._seq_no/] diff --git a/docs/reference/docs/get.asciidoc b/docs/reference/docs/get.asciidoc index f3f3ede247d..f6b254844f1 100644 --- a/docs/reference/docs/get.asciidoc +++ b/docs/reference/docs/get.asciidoc @@ -234,22 +234,22 @@ The API returns the following result: [source,console-result] -------------------------------------------------- { - "_index" : "twitter", - "_type" : "_doc", - "_id" : "0", - "_version" : 1, - "_seq_no" : 10, - "_primary_term" : 1, - "found": true, - "_source" : { - "user" : "kimchy", - "date" : "2009-11-15T14:12:12", - "likes": 0, - "message" : "trying out Elasticsearch" - } + "_index": "twitter", + "_type": "_doc", + "_id": "0", + "_version": 1, + "_seq_no": 10, + "_primary_term": 1, + "found": true, + "_source": { + "user": "kimchy", + "date": "2009-11-15T14:12:12", + "likes": 0, + "message": "trying out Elasticsearch" + } } -------------------------------------------------- -// TESTRESPONSE[s/"_seq_no" : \d+/"_seq_no" : $body._seq_no/ s/"_primary_term" : 1/"_primary_term" : $body._primary_term/] +// TESTRESPONSE[s/"_seq_no": \d+/"_seq_no": $body._seq_no/ s/"_primary_term": 1/"_primary_term": $body._primary_term/] Check to see if a document with the `_id` 0 exists: @@ -327,8 +327,8 @@ Now we can add a document: -------------------------------------------------- PUT twitter/_doc/1 { - "counter" : 1, - "tags" : ["red"] + "counter": 1, + "tags": [ "red" ] } -------------------------------------------------- // TEST[continued] @@ -371,8 +371,8 @@ You can also retrieve metadata fields like the `_routing` field: -------------------------------------------------- PUT twitter/_doc/2?routing=user1 { - "counter" : 1, - "tags" : ["white"] + "counter" : 1, + "tags" : ["white"] } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/docs/index_.asciidoc b/docs/reference/docs/index_.asciidoc index f93d463f1e3..2f90ca3d741 100644 --- a/docs/reference/docs/index_.asciidoc +++ b/docs/reference/docs/index_.asciidoc @@ -190,23 +190,23 @@ creation of indices. It does not affect the creation of data streams. -------------------------------------------------- PUT _cluster/settings { - "persistent": { - "action.auto_create_index": "twitter,index10,-index1*,+ind*" <1> - } + "persistent": { + "action.auto_create_index": "twitter,index10,-index1*,+ind*" <1> + } } PUT _cluster/settings { - "persistent": { - "action.auto_create_index": "false" <2> - } + "persistent": { + "action.auto_create_index": "false" <2> + } } PUT _cluster/settings { - "persistent": { - "action.auto_create_index": "true" <3> - } + "persistent": { + "action.auto_create_index": "true" <3> + } } -------------------------------------------------- @@ -239,9 +239,9 @@ the document. -------------------------------------------------- POST twitter/_doc/ { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- @@ -250,21 +250,21 @@ The API returns the following result: [source,console-result] -------------------------------------------------- { - "_shards" : { - "total" : 2, - "failed" : 0, - "successful" : 2 - }, - "_index" : "twitter", - "_type" : "_doc", - "_id" : "W0tpsmIBdwcYyG50zbta", - "_version" : 1, - "_seq_no" : 0, - "_primary_term" : 1, - "result": "created" + "_shards": { + "total": 2, + "failed": 0, + "successful": 2 + }, + "_index": "twitter", + "_type": "_doc", + "_id": "W0tpsmIBdwcYyG50zbta", + "_version": 1, + "_seq_no": 0, + "_primary_term": 1, + "result": "created" } -------------------------------------------------- -// TESTRESPONSE[s/W0tpsmIBdwcYyG50zbta/$body._id/ s/"successful" : 2/"successful" : 1/] +// TESTRESPONSE[s/W0tpsmIBdwcYyG50zbta/$body._id/ s/"successful": 2/"successful": 1/] [float] [[optimistic-concurrency-control-index]] @@ -289,9 +289,9 @@ on a per-operation basis using the `routing` parameter. For example: -------------------------------------------------- POST twitter/_doc?routing=kimchy { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- @@ -366,11 +366,11 @@ replication succeeded/failed. [source,js] -------------------------------------------------- { - "_shards" : { - "total" : 2, - "failed" : 0, - "successful" : 2 - } + "_shards": { + "total": 2, + "failed": 0, + "successful": 2 + } } -------------------------------------------------- // NOTCONSOLE @@ -414,9 +414,9 @@ to 5 minutes: -------------------------------------------------- PUT twitter/_doc/1?timeout=5m { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- @@ -443,7 +443,7 @@ conflict will occur and the index operation will fail. For example: -------------------------------------------------- PUT twitter/_doc/1?version=2&version_type=external { - "message" : "elasticsearch now has versioning support, double cool!" + "message" : "elasticsearch now has versioning support, double cool!" } -------------------------------------------------- // TEST[continued] @@ -501,9 +501,9 @@ Insert a JSON document into the `twitter` index with an `_id` of 1: -------------------------------------------------- PUT twitter/_doc/1 { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- @@ -512,21 +512,21 @@ The API returns the following result: [source,console-result] -------------------------------------------------- { - "_shards" : { - "total" : 2, - "failed" : 0, - "successful" : 2 - }, - "_index" : "twitter", - "_type" : "_doc", - "_id" : "1", - "_version" : 1, - "_seq_no" : 0, - "_primary_term" : 1, - "result" : "created" + "_shards": { + "total": 2, + "failed": 0, + "successful": 2 + }, + "_index": "twitter", + "_type": "_doc", + "_id": "1", + "_version": 1, + "_seq_no": 0, + "_primary_term": 1, + "result": "created" } -------------------------------------------------- -// TESTRESPONSE[s/"successful" : 2/"successful" : 1/] +// TESTRESPONSE[s/"successful": 2/"successful": 1/] Use the `_create` resource to index a document into the `twitter` index if no document with that ID exists: @@ -535,9 +535,9 @@ no document with that ID exists: -------------------------------------------------- PUT twitter/_create/1 { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- @@ -548,8 +548,8 @@ index if no document with that ID exists: -------------------------------------------------- PUT twitter/_doc/1?op_type=create { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- diff --git a/docs/reference/docs/multi-get.asciidoc b/docs/reference/docs/multi-get.asciidoc index 1ac7ddf202b..9e01962e1c4 100644 --- a/docs/reference/docs/multi-get.asciidoc +++ b/docs/reference/docs/multi-get.asciidoc @@ -10,16 +10,16 @@ Retrieves multiple JSON documents by ID. -------------------------------------------------- GET /_mget { - "docs" : [ - { - "_index" : "twitter", - "_id" : "1" - }, - { - "_index" : "twitter", - "_id" : "2" - } - ] + "docs": [ + { + "_index": "twitter", + "_id": "1" + }, + { + "_index": "twitter", + "_id": "2" + } + ] } -------------------------------------------------- // TEST[setup:twitter] @@ -130,16 +130,16 @@ If you specify an index in the request URI, only the document IDs are required i -------------------------------------------------- GET /twitter/_mget { - "docs" : [ - { - "_type" : "_doc", - "_id" : "1" - }, - { - "_type" : "_doc", - "_id" : "2" - } - ] + "docs": [ + { + "_type": "_doc", + "_id": "1" + }, + { + "_type": "_doc", + "_id": "2" + } + ] } -------------------------------------------------- @@ -149,14 +149,14 @@ And type: -------------------------------------------------- GET /test/_doc/_mget { - "docs" : [ - { - "_id" : "1" - }, - { - "_id" : "2" - } - ] + "docs": [ + { + "_id": "1" + }, + { + "_id": "2" + } + ] } -------------------------------------------------- // TEST[setup:twitter] @@ -167,7 +167,7 @@ You can use the `ids` element to simplify the request: -------------------------------------------------- GET /twitter/_mget { - "ids" : ["1", "2"] + "ids" : ["1", "2"] } -------------------------------------------------- // TEST[setup:twitter] @@ -189,29 +189,29 @@ from document 3 but filters out the `user.location` field. -------------------------------------------------- GET /_mget { - "docs" : [ - { - "_index" : "test", - "_type" : "_doc", - "_id" : "1", - "_source" : false - }, - { - "_index" : "test", - "_type" : "_doc", - "_id" : "2", - "_source" : ["field3", "field4"] - }, - { - "_index" : "test", - "_type" : "_doc", - "_id" : "3", - "_source" : { - "include": ["user"], - "exclude": ["user.location"] - } - } - ] + "docs": [ + { + "_index": "test", + "_type": "_doc", + "_id": "1", + "_source": false + }, + { + "_index": "test", + "_type": "_doc", + "_id": "2", + "_source": [ "field3", "field4" ] + }, + { + "_index": "test", + "_type": "_doc", + "_id": "3", + "_source": { + "include": [ "user" ], + "exclude": [ "user.location" ] + } + } + ] } -------------------------------------------------- @@ -230,20 +230,20 @@ For example, the following request retrieves `field1` and `field2` from document -------------------------------------------------- GET /_mget { - "docs" : [ - { - "_index" : "test", - "_type" : "_doc", - "_id" : "1", - "stored_fields" : ["field1", "field2"] - }, - { - "_index" : "test", - "_type" : "_doc", - "_id" : "2", - "stored_fields" : ["field3", "field4"] - } - ] + "docs": [ + { + "_index": "test", + "_type": "_doc", + "_id": "1", + "stored_fields": [ "field1", "field2" ] + }, + { + "_index": "test", + "_type": "_doc", + "_id": "2", + "stored_fields": [ "field3", "field4" ] + } + ] } -------------------------------------------------- @@ -255,15 +255,15 @@ overridden to return `field3` and `field4` for document 2. -------------------------------------------------- GET /test/_doc/_mget?stored_fields=field1,field2 { - "docs" : [ - { - "_id" : "1" - }, - { - "_id" : "2", - "stored_fields" : ["field3", "field4"] - } - ] + "docs": [ + { + "_id": "1" + }, + { + "_id": "2", + "stored_fields": [ "field3", "field4" ] + } + ] } -------------------------------------------------- @@ -278,18 +278,18 @@ and fetches `test/_doc/1` from the shard corresponding to routing key `key2`. -------------------------------------------------- GET /_mget?routing=key1 { - "docs" : [ - { - "_index" : "test", - "_type" : "_doc", - "_id" : "1", - "routing" : "key2" - }, - { - "_index" : "test", - "_type" : "_doc", - "_id" : "2" - } - ] + "docs": [ + { + "_index": "test", + "_type": "_doc", + "_id": "1", + "routing": "key2" + }, + { + "_index": "test", + "_type": "_doc", + "_id": "2" + } + ] } -------------------------------------------------- diff --git a/docs/reference/docs/multi-termvectors.asciidoc b/docs/reference/docs/multi-termvectors.asciidoc index 657c375c5dc..5d98c355267 100644 --- a/docs/reference/docs/multi-termvectors.asciidoc +++ b/docs/reference/docs/multi-termvectors.asciidoc @@ -114,13 +114,13 @@ following simplified syntax: -------------------------------------------------- POST /twitter/_mtermvectors { - "ids" : ["1", "2"], - "parameters": { - "fields": [ - "message" - ], - "term_statistics": true - } + "ids": [ "1", "2" ], + "parameters": { + "fields": [ + "message" + ], + "term_statistics": true + } } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/docs/termvectors.asciidoc b/docs/reference/docs/termvectors.asciidoc index f8d4d00a9d4..af6eeaa36a0 100644 --- a/docs/reference/docs/termvectors.asciidoc +++ b/docs/reference/docs/termvectors.asciidoc @@ -246,61 +246,61 @@ Response: [source,console-result] -------------------------------------------------- { - "_id": "1", - "_index": "twitter", + "_id": "1", + "_index": "twitter", "_type": "_doc", - "_version": 1, - "found": true, - "took": 6, - "term_vectors": { - "text": { - "field_statistics": { - "doc_count": 2, - "sum_doc_freq": 6, - "sum_ttf": 8 + "_version": 1, + "found": true, + "took": 6, + "term_vectors": { + "text": { + "field_statistics": { + "doc_count": 2, + "sum_doc_freq": 6, + "sum_ttf": 8 + }, + "terms": { + "test": { + "doc_freq": 2, + "term_freq": 3, + "tokens": [ + { + "end_offset": 12, + "payload": "d29yZA==", + "position": 1, + "start_offset": 8 }, - "terms": { - "test": { - "doc_freq": 2, - "term_freq": 3, - "tokens": [ - { - "end_offset": 12, - "payload": "d29yZA==", - "position": 1, - "start_offset": 8 - }, - { - "end_offset": 17, - "payload": "d29yZA==", - "position": 2, - "start_offset": 13 - }, - { - "end_offset": 22, - "payload": "d29yZA==", - "position": 3, - "start_offset": 18 - } - ], - "ttf": 4 - }, - "twitter": { - "doc_freq": 2, - "term_freq": 1, - "tokens": [ - { - "end_offset": 7, - "payload": "d29yZA==", - "position": 0, - "start_offset": 0 - } - ], - "ttf": 2 - } + { + "end_offset": 17, + "payload": "d29yZA==", + "position": 2, + "start_offset": 13 + }, + { + "end_offset": 22, + "payload": "d29yZA==", + "position": 3, + "start_offset": 18 } + ], + "ttf": 4 + }, + "twitter": { + "doc_freq": 2, + "term_freq": 1, + "tokens": [ + { + "end_offset": 7, + "payload": "d29yZA==", + "position": 0, + "start_offset": 0 + } + ], + "ttf": 2 } + } } + } } -------------------------------------------------- // TEST[continued] @@ -427,18 +427,18 @@ their tf-idf must be too low. -------------------------------------------------- GET /imdb/_termvectors { - "doc": { - "plot": "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil." - }, - "term_statistics" : true, - "field_statistics" : true, - "positions": false, - "offsets": false, - "filter" : { - "max_num_terms" : 3, - "min_term_freq" : 1, - "min_doc_freq" : 1 - } + "doc": { + "plot": "When wealthy industrialist Tony Stark is forced to build an armored suit after a life-threatening incident, he ultimately decides to use its technology to fight against evil." + }, + "term_statistics": true, + "field_statistics": true, + "positions": false, + "offsets": false, + "filter": { + "max_num_terms": 3, + "min_term_freq": 1, + "min_doc_freq": 1 + } } -------------------------------------------------- // TEST[skip:no imdb test index] diff --git a/docs/reference/docs/update.asciidoc b/docs/reference/docs/update.asciidoc index 899bb79ff7f..f01a89cce0b 100644 --- a/docs/reference/docs/update.asciidoc +++ b/docs/reference/docs/update.asciidoc @@ -86,8 +86,8 @@ First, let's index a simple doc: -------------------------------------------------- PUT test/_doc/1 { - "counter" : 1, - "tags" : ["red"] + "counter" : 1, + "tags" : ["red"] } -------------------------------------------------- @@ -98,13 +98,13 @@ following script: -------------------------------------------------- POST test/_update/1 { - "script" : { - "source": "ctx._source.counter += params.count", - "lang": "painless", - "params" : { - "count" : 4 - } + "script" : { + "source": "ctx._source.counter += params.count", + "lang": "painless", + "params" : { + "count" : 4 } + } } -------------------------------------------------- // TEST[continued] @@ -116,13 +116,13 @@ Similarly, you could use and update script to add a tag to the list of tags -------------------------------------------------- POST test/_update/1 { - "script" : { - "source": "ctx._source.tags.add(params.tag)", - "lang": "painless", - "params" : { - "tag" : "blue" - } + "script": { + "source": "ctx._source.tags.add(params.tag)", + "lang": "painless", + "params": { + "tag": "blue" } + } } -------------------------------------------------- // TEST[continued] @@ -137,13 +137,13 @@ script just removes one occurrence. -------------------------------------------------- POST test/_update/1 { - "script" : { - "source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }", - "lang": "painless", - "params" : { - "tag" : "blue" - } + "script": { + "source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }", + "lang": "painless", + "params": { + "tag": "blue" } + } } -------------------------------------------------- // TEST[continued] @@ -155,7 +155,7 @@ adds the field `new_field`: -------------------------------------------------- POST test/_update/1 { - "script" : "ctx._source.new_field = 'value_of_new_field'" + "script" : "ctx._source.new_field = 'value_of_new_field'" } -------------------------------------------------- // TEST[continued] @@ -166,7 +166,7 @@ Conversely, this script removes the field `new_field`: -------------------------------------------------- POST test/_update/1 { - "script" : "ctx._source.remove('new_field')" + "script" : "ctx._source.remove('new_field')" } -------------------------------------------------- // TEST[continued] @@ -179,13 +179,13 @@ the `tags` field contains `green`, otherwise it does nothing (`noop`): -------------------------------------------------- POST test/_update/1 { - "script" : { - "source": "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'none' }", - "lang": "painless", - "params" : { - "tag" : "green" - } + "script": { + "source": "if (ctx._source.tags.contains(params.tag)) { ctx.op = 'delete' } else { ctx.op = 'none' }", + "lang": "painless", + "params": { + "tag": "green" } + } } -------------------------------------------------- // TEST[continued] @@ -200,9 +200,9 @@ existing document: -------------------------------------------------- POST test/_update/1 { - "doc" : { - "name" : "new_name" - } + "doc": { + "name": "new_name" + } } -------------------------------------------------- // TEST[continued] @@ -220,9 +220,9 @@ anything and return `"result": "noop"`: -------------------------------------------------- POST test/_update/1 { - "doc" : { - "name" : "new_name" - } + "doc": { + "name": "new_name" + } } -------------------------------------------------- // TEST[continued] @@ -254,10 +254,10 @@ You can disable this behavior by setting `"detect_noop": false`: -------------------------------------------------- POST test/_update/1 { - "doc" : { - "name" : "new_name" - }, - "detect_noop": false + "doc": { + "name": "new_name" + }, + "detect_noop": false } -------------------------------------------------- // TEST[continued] @@ -274,16 +274,16 @@ are inserted as a new document. If the document exists, the -------------------------------------------------- POST test/_update/1 { - "script" : { - "source": "ctx._source.counter += params.count", - "lang": "painless", - "params" : { - "count" : 4 - } - }, - "upsert" : { - "counter" : 1 + "script": { + "source": "ctx._source.counter += params.count", + "lang": "painless", + "params": { + "count": 4 } + }, + "upsert": { + "counter": 1 + } } -------------------------------------------------- // TEST[continued] @@ -299,18 +299,18 @@ To run the script whether or not the document exists, set `scripted_upsert` to -------------------------------------------------- POST sessions/_update/dh3sgudg8gsrgl { - "scripted_upsert":true, - "script" : { - "id": "my_web_session_summariser", - "params" : { - "pageViewEvent" : { - "url":"foo.com/bar", - "response":404, - "time":"2014-01-01 12:32" - } - } - }, - "upsert" : {} + "scripted_upsert": true, + "script": { + "id": "my_web_session_summariser", + "params": { + "pageViewEvent": { + "url": "foo.com/bar", + "response": 404, + "time": "2014-01-01 12:32" + } + } + }, + "upsert": {} } -------------------------------------------------- // TEST[s/"id": "my_web_session_summariser"/"source": "ctx._source.page_view_event = params.pageViewEvent"/] @@ -328,10 +328,10 @@ value: -------------------------------------------------- POST test/_update/1 { - "doc" : { - "name" : "new_name" - }, - "doc_as_upsert" : true + "doc": { + "name": "new_name" + }, + "doc_as_upsert": true } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/getting-started.asciidoc b/docs/reference/getting-started.asciidoc index 7258bd853ac..ec199997b69 100755 --- a/docs/reference/getting-started.asciidoc +++ b/docs/reference/getting-started.asciidoc @@ -333,17 +333,17 @@ To get some data into {es} that you can start searching and analyzing: [source,js] -------------------------------------------------- { - "account_number": 0, - "balance": 16623, - "firstname": "Bradshaw", - "lastname": "Mckenzie", - "age": 29, - "gender": "F", - "address": "244 Columbus Place", - "employer": "Euron", - "email": "bradshawmckenzie@euron.com", - "city": "Hobucken", - "state": "CO" + "account_number": 0, + "balance": 16623, + "firstname": "Bradshaw", + "lastname": "Mckenzie", + "age": 29, + "gender": "F", + "address": "244 Columbus Place", + "employer": "Euron", + "email": "bradshawmckenzie@euron.com", + "city": "Hobucken", + "state": "CO" } -------------------------------------------------- // NOTCONSOLE diff --git a/docs/reference/graph/explore.asciidoc b/docs/reference/graph/explore.asciidoc index 9635eb84173..81f75ff6009 100644 --- a/docs/reference/graph/explore.asciidoc +++ b/docs/reference/graph/explore.asciidoc @@ -201,23 +201,23 @@ An initial search typically begins with a query to identify strongly related ter -------------------------------------------------- POST clicklogs/_graph/explore { - "query": { <1> - "match": { - "query.raw": "midi" - } - }, - "vertices": [ <2> - { - "field": "product" - } - ], - "connections": { <3> - "vertices": [ - { - "field": "query.raw" - } - ] + "query": { <1> + "match": { + "query.raw": "midi" } + }, + "vertices": [ <2> + { + "field": "product" + } + ], + "connections": { <3> + "vertices": [ + { + "field": "query.raw" + } + ] + } } -------------------------------------------------- @@ -306,51 +306,51 @@ every document could be of interest, see the -------------------------------------------------- POST clicklogs/_graph/explore { - "query": { - "match": { - "query.raw": "midi" - } + "query": { + "match": { + "query.raw": "midi" + } + }, + "controls": { + "use_significance": false, <1> + "sample_size": 2000, <2> + "timeout": 2000, <3> + "sample_diversity": { <4> + "field": "category.raw", + "max_docs_per_value": 500 + } + }, + "vertices": [ + { + "field": "product", + "size": 5, <5> + "min_doc_count": 10, <6> + "shard_min_doc_count": 3 <7> + } + ], + "connections": { + "query": { <8> + "bool": { + "filter": [ + { + "range": { + "query_time": { + "gte": "2015-10-01 00:00:00" + } + } + } + ] + } }, - "controls": { - "use_significance": false,<1> - "sample_size": 2000,<2> - "timeout": 2000,<3> - "sample_diversity": {<4> - "field": "category.raw", - "max_docs_per_value": 500 - } - }, - "vertices": [ + "vertices": [ { - "field": "product", - "size": 5,<5> - "min_doc_count": 10,<6> - "shard_min_doc_count": 3<7> + "field": "query.raw", + "size": 5, + "min_doc_count": 10, + "shard_min_doc_count": 3 } - ], - "connections": { - "query": {<8> - "bool": { - "filter": [ - { - "range": { - "query_time": { - "gte": "2015-10-01 00:00:00" - } - } - } - ] - } - }, - "vertices": [ - { - "field": "query.raw", - "size": 5, - "min_doc_count": 10, - "shard_min_doc_count": 3 - } - ] - } + ] + } } -------------------------------------------------- diff --git a/docs/reference/how-to/recipes/scoring.asciidoc b/docs/reference/how-to/recipes/scoring.asciidoc index 2ccb7a3319a..9996a5b193f 100644 --- a/docs/reference/how-to/recipes/scoring.asciidoc +++ b/docs/reference/how-to/recipes/scoring.asciidoc @@ -104,16 +104,16 @@ look like this: -------------------------------------------------- PUT index { - "mappings": { - "properties": { - "body": { - "type": "text" - }, - "pagerank": { - "type": "long" - } - } + "mappings": { + "properties": { + "body": { + "type": "text" + }, + "pagerank": { + "type": "long" + } } + } } -------------------------------------------------- @@ -123,16 +123,16 @@ PUT index -------------------------------------------------- GET index/_search { - "query" : { - "script_score" : { - "query" : { - "match": { "body": "elasticsearch" } - }, - "script" : { - "source" : "_score * saturation(doc['pagerank'].value, 10)" <1> - } - } + "query": { + "script_score": { + "query": { + "match": { "body": "elasticsearch" } + }, + "script": { + "source": "_score * saturation(doc['pagerank'].value, 10)" <1> + } } + } } -------------------------------------------------- //TEST[continued] @@ -148,16 +148,16 @@ look like below: -------------------------------------------------- PUT index { - "mappings": { - "properties": { - "body": { - "type": "text" - }, - "pagerank": { - "type": "rank_feature" - } - } + "mappings": { + "properties": { + "body": { + "type": "text" + }, + "pagerank": { + "type": "rank_feature" + } } + } } -------------------------------------------------- // TEST @@ -168,21 +168,21 @@ PUT index -------------------------------------------------- GET _search { - "query" : { - "bool" : { - "must": { - "match": { "body": "elasticsearch" } - }, - "should": { - "rank_feature": { - "field": "pagerank", <1> - "saturation": { - "pivot": 10 - } - } - } + "query": { + "bool": { + "must": { + "match": { "body": "elasticsearch" } + }, + "should": { + "rank_feature": { + "field": "pagerank", <1> + "saturation": { + "pivot": 10 + } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/index-modules/blocks.asciidoc b/docs/reference/index-modules/blocks.asciidoc index 5709f62d428..cb78bf6d63d 100644 --- a/docs/reference/index-modules/blocks.asciidoc +++ b/docs/reference/index-modules/blocks.asciidoc @@ -150,11 +150,11 @@ The API returns following response: [source,console-result] -------------------------------------------------- { - "acknowledged" : true, - "shards_acknowledged" : true, - "indices" : [ { - "name" : "my_index", - "blocked" : true - } ] + "acknowledged" : true, + "shards_acknowledged" : true, + "indices" : [ { + "name" : "my_index", + "blocked" : true + } ] } -------------------------------------------------- diff --git a/docs/reference/index-modules/index-sorting.asciidoc b/docs/reference/index-modules/index-sorting.asciidoc index 340ffa8491c..ea1bc787b83 100644 --- a/docs/reference/index-modules/index-sorting.asciidoc +++ b/docs/reference/index-modules/index-sorting.asciidoc @@ -16,19 +16,19 @@ For instance the following example shows how to define a sort on a single field: -------------------------------------------------- PUT twitter { - "settings" : { - "index" : { - "sort.field" : "date", <1> - "sort.order" : "desc" <2> - } - }, - "mappings": { - "properties": { - "date": { - "type": "date" - } - } + "settings": { + "index": { + "sort.field": "date", <1> + "sort.order": "desc" <2> } + }, + "mappings": { + "properties": { + "date": { + "type": "date" + } + } + } } -------------------------------------------------- @@ -41,23 +41,23 @@ It is also possible to sort the index by more than one field: -------------------------------------------------- PUT twitter { - "settings" : { - "index" : { - "sort.field" : ["username", "date"], <1> - "sort.order" : ["asc", "desc"] <2> - } - }, - "mappings": { - "properties": { - "username": { - "type": "keyword", - "doc_values": true - }, - "date": { - "type": "date" - } - } + "settings": { + "index": { + "sort.field": [ "username", "date" ], <1> + "sort.order": [ "asc", "desc" ] <2> } + }, + "mappings": { + "properties": { + "username": { + "type": "keyword", + "doc_values": true + }, + "date": { + "type": "date" + } + } + } } -------------------------------------------------- @@ -114,19 +114,19 @@ For example, let's say we have an index that contains events sorted by a timesta -------------------------------------------------- PUT events { - "settings" : { - "index" : { - "sort.field" : "timestamp", - "sort.order" : "desc" <1> - } - }, - "mappings": { - "properties": { - "timestamp": { - "type": "date" - } - } + "settings": { + "index": { + "sort.field": "timestamp", + "sort.order": "desc" <1> } + }, + "mappings": { + "properties": { + "timestamp": { + "type": "date" + } + } + } } -------------------------------------------------- @@ -138,10 +138,10 @@ You can search for the last 10 events with: -------------------------------------------------- GET /events/_search { - "size": 10, - "sort": [ - { "timestamp": "desc" } - ] + "size": 10, + "sort": [ + { "timestamp": "desc" } + ] } -------------------------------------------------- // TEST[continued] @@ -159,11 +159,11 @@ to false: -------------------------------------------------- GET /events/_search { - "size": 10, - "sort": [ <1> - { "timestamp": "desc" } - ], - "track_total_hits": false + "size": 10, + "sort": [ <1> + { "timestamp": "desc" } + ], + "track_total_hits": false } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/index-modules/slowlog.asciidoc b/docs/reference/index-modules/slowlog.asciidoc index 34a6d89474c..0ee09d8317a 100644 --- a/docs/reference/index-modules/slowlog.asciidoc +++ b/docs/reference/index-modules/slowlog.asciidoc @@ -33,15 +33,15 @@ All of the above settings are _dynamic_ and can be set for each index using the -------------------------------------------------- PUT /twitter/_settings { - "index.search.slowlog.threshold.query.warn": "10s", - "index.search.slowlog.threshold.query.info": "5s", - "index.search.slowlog.threshold.query.debug": "2s", - "index.search.slowlog.threshold.query.trace": "500ms", - "index.search.slowlog.threshold.fetch.warn": "1s", - "index.search.slowlog.threshold.fetch.info": "800ms", - "index.search.slowlog.threshold.fetch.debug": "500ms", - "index.search.slowlog.threshold.fetch.trace": "200ms", - "index.search.slowlog.level": "info" + "index.search.slowlog.threshold.query.warn": "10s", + "index.search.slowlog.threshold.query.info": "5s", + "index.search.slowlog.threshold.query.debug": "2s", + "index.search.slowlog.threshold.query.trace": "500ms", + "index.search.slowlog.threshold.fetch.warn": "1s", + "index.search.slowlog.threshold.fetch.info": "800ms", + "index.search.slowlog.threshold.fetch.debug": "500ms", + "index.search.slowlog.threshold.fetch.trace": "200ms", + "index.search.slowlog.level": "info" } -------------------------------------------------- // TEST[setup:twitter] @@ -143,12 +143,12 @@ All of the above settings are _dynamic_ and can be set for each index using the -------------------------------------------------- PUT /twitter/_settings { - "index.indexing.slowlog.threshold.index.warn": "10s", - "index.indexing.slowlog.threshold.index.info": "5s", - "index.indexing.slowlog.threshold.index.debug": "2s", - "index.indexing.slowlog.threshold.index.trace": "500ms", - "index.indexing.slowlog.level": "info", - "index.indexing.slowlog.source": "1000" + "index.indexing.slowlog.threshold.index.warn": "10s", + "index.indexing.slowlog.threshold.index.info": "5s", + "index.indexing.slowlog.threshold.index.debug": "2s", + "index.indexing.slowlog.threshold.index.trace": "500ms", + "index.indexing.slowlog.level": "info", + "index.indexing.slowlog.source": "1000" } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/indices/add-alias.asciidoc b/docs/reference/indices/add-alias.asciidoc index 75dbd41a45d..10625203dd8 100644 --- a/docs/reference/indices/add-alias.asciidoc +++ b/docs/reference/indices/add-alias.asciidoc @@ -85,11 +85,11 @@ with a mapping for the `user_id` field: -------------------------------------------------- PUT /users { - "mappings" : { - "properties" : { - "user_id" : {"type" : "integer"} - } + "mappings" : { + "properties" : { + "user_id" : {"type" : "integer"} } + } } -------------------------------------------------- @@ -99,12 +99,12 @@ Then add the index alias for a specific user, `user_12`: -------------------------------------------------- PUT /users/_alias/user_12 { - "routing" : "12", - "filter" : { - "term" : { - "user_id" : 12 - } + "routing" : "12", + "filter" : { + "term" : { + "user_id" : 12 } + } } -------------------------------------------------- // TEST[continued] @@ -119,18 +119,18 @@ to add an index alias during index creation. -------------------------------------------------- PUT /logs_20302801 { - "mappings" : { - "properties" : { - "year" : {"type" : "integer"} - } - }, - "aliases" : { - "current_day" : {}, - "2030" : { - "filter" : { - "term" : {"year" : 2030 } - } - } + "mappings": { + "properties": { + "year": { "type": "integer" } } + }, + "aliases": { + "current_day": {}, + "2030": { + "filter": { + "term": { "year": 2030 } + } + } + } } -------------------------------------------------- diff --git a/docs/reference/indices/aliases.asciidoc b/docs/reference/indices/aliases.asciidoc index 41d6cf2d019..69f18259b90 100644 --- a/docs/reference/indices/aliases.asciidoc +++ b/docs/reference/indices/aliases.asciidoc @@ -12,9 +12,9 @@ include::{es-repo-dir}/glossary.asciidoc[tag=index-alias-desc] ---- POST /_aliases { - "actions" : [ - { "add" : { "index" : "twitter", "alias" : "alias1" } } - ] + "actions" : [ + { "add" : { "index" : "twitter", "alias" : "alias1" } } + ] } ---- // TEST[setup:twitter] @@ -170,9 +170,9 @@ The following request adds the `alias1` alias to the `test1` index. -------------------------------------------------- POST /_aliases { - "actions" : [ - { "add" : { "index" : "test1", "alias" : "alias1" } } - ] + "actions" : [ + { "add" : { "index" : "test1", "alias" : "alias1" } } + ] } -------------------------------------------------- // TEST[s/^/PUT test1\nPUT test2\n/] @@ -186,9 +186,9 @@ The following request removes the `alias1` alias. -------------------------------------------------- POST /_aliases { - "actions" : [ - { "remove" : { "index" : "test1", "alias" : "alias1" } } - ] + "actions" : [ + { "remove" : { "index" : "test1", "alias" : "alias1" } } + ] } -------------------------------------------------- // TEST[continued] @@ -204,10 +204,10 @@ period of time where the alias does not point to an index: -------------------------------------------------- POST /_aliases { - "actions" : [ - { "remove" : { "index" : "test1", "alias" : "alias1" } }, - { "add" : { "index" : "test1", "alias" : "alias2" } } - ] + "actions" : [ + { "remove" : { "index" : "test1", "alias" : "alias1" } }, + { "add" : { "index" : "test1", "alias" : "alias2" } } + ] } -------------------------------------------------- // TEST[continued] @@ -222,10 +222,10 @@ actions: -------------------------------------------------- POST /_aliases { - "actions" : [ - { "add" : { "index" : "test1", "alias" : "alias1" } }, - { "add" : { "index" : "test2", "alias" : "alias1" } } - ] + "actions" : [ + { "add" : { "index" : "test1", "alias" : "alias1" } }, + { "add" : { "index" : "test2", "alias" : "alias1" } } + ] } -------------------------------------------------- // TEST[s/^/PUT test1\nPUT test2\n/] @@ -236,9 +236,9 @@ Multiple indices can be specified for an action with the `indices` array syntax: -------------------------------------------------- POST /_aliases { - "actions" : [ - { "add" : { "indices" : ["test1", "test2"], "alias" : "alias1" } } - ] + "actions" : [ + { "add" : { "indices" : ["test1", "test2"], "alias" : "alias1" } } + ] } -------------------------------------------------- // TEST[s/^/PUT test1\nPUT test2\n/] @@ -253,9 +253,9 @@ more than one index that share a common name: -------------------------------------------------- POST /_aliases { - "actions" : [ - { "add" : { "index" : "test*", "alias" : "all_test_indices" } } - ] + "actions" : [ + { "add" : { "index" : "test*", "alias" : "all_test_indices" } } + ] } -------------------------------------------------- // TEST[s/^/PUT test1\nPUT test2\n/] @@ -278,10 +278,10 @@ PUT test <1> PUT test_2 <2> POST /_aliases { - "actions" : [ - { "add": { "index": "test_2", "alias": "test" } }, - { "remove_index": { "index": "test" } } <3> - ] + "actions" : [ + { "add": { "index": "test_2", "alias": "test" } }, + { "remove_index": { "index": "test" } } <3> + ] } -------------------------------------------------- @@ -320,15 +320,15 @@ Now we can create an alias that uses a filter on field `user`: -------------------------------------------------- POST /_aliases { - "actions" : [ - { - "add" : { - "index" : "test1", - "alias" : "alias2", - "filter" : { "term" : { "user" : "kimchy" } } - } - } - ] + "actions": [ + { + "add": { + "index": "test1", + "alias": "alias2", + "filter": { "term": { "user": "kimchy" } } + } + } + ] } -------------------------------------------------- // TEST[continued] @@ -348,15 +348,15 @@ automatically modified to use value `1` for routing: -------------------------------------------------- POST /_aliases { - "actions" : [ - { - "add" : { - "index" : "test", - "alias" : "alias1", - "routing" : "1" - } - } - ] + "actions": [ + { + "add": { + "index": "test", + "alias": "alias1", + "routing": "1" + } + } + ] } -------------------------------------------------- // TEST[s/^/PUT test\n/] @@ -368,16 +368,16 @@ and indexing operations: -------------------------------------------------- POST /_aliases { - "actions" : [ - { - "add" : { - "index" : "test", - "alias" : "alias2", - "search_routing" : "1,2", - "index_routing" : "2" - } - } - ] + "actions": [ + { + "add": { + "index": "test", + "alias": "alias2", + "search_routing": "1,2", + "index_routing": "2" + } + } + ] } -------------------------------------------------- // TEST[s/^/PUT test\n/] @@ -415,21 +415,21 @@ Rollover (see <>). -------------------------------------------------- POST /_aliases { - "actions" : [ - { - "add" : { - "index" : "test", - "alias" : "alias1", - "is_write_index" : true - } - }, - { - "add" : { - "index" : "test2", - "alias" : "alias1" - } - } - ] + "actions": [ + { + "add": { + "index": "test", + "alias": "alias1", + "is_write_index": true + } + }, + { + "add": { + "index": "test2", + "alias": "alias1" + } + } + ] } -------------------------------------------------- // TEST[s/^/PUT test\nPUT test2\n/] @@ -441,7 +441,7 @@ In this example, we associate the alias `alias1` to both `test` and `test2`, whe -------------------------------------------------- PUT /alias1/_doc/1 { - "foo": "bar" + "foo": "bar" } -------------------------------------------------- // TEST[continued] @@ -462,21 +462,21 @@ do an atomic swap. The swap is not dependent on the ordering of the actions. -------------------------------------------------- POST /_aliases { - "actions" : [ - { - "add" : { - "index" : "test", - "alias" : "alias1", - "is_write_index" : false - } - }, { - "add" : { - "index" : "test2", - "alias" : "alias1", - "is_write_index" : true - } - } - ] + "actions": [ + { + "add": { + "index": "test", + "alias": "alias1", + "is_write_index": false + } + }, { + "add": { + "index": "test2", + "alias": "alias1", + "is_write_index": true + } + } + ] } -------------------------------------------------- // TEST[s/^/PUT test\nPUT test2\n/] diff --git a/docs/reference/indices/apis/reload-analyzers.asciidoc b/docs/reference/indices/apis/reload-analyzers.asciidoc index 38195f72bc5..15f92e0d697 100644 --- a/docs/reference/indices/apis/reload-analyzers.asciidoc +++ b/docs/reference/indices/apis/reload-analyzers.asciidoc @@ -102,34 +102,34 @@ NOTE: Using the following analyzer as an index analyzer results in an error. -------------------------------------------------- PUT /my_index { - "settings": { - "index" : { - "analysis" : { - "analyzer" : { - "my_synonyms" : { - "tokenizer" : "whitespace", - "filter" : ["synonym"] - } - }, - "filter" : { - "synonym" : { - "type" : "synonym_graph", - "synonyms_path" : "analysis/synonym.txt", <1> - "updateable" : true <2> - } - } - } - } - }, - "mappings": { - "properties": { - "text": { - "type": "text", - "analyzer" : "standard", - "search_analyzer": "my_synonyms" <3> - } + "settings": { + "index": { + "analysis": { + "analyzer": { + "my_synonyms": { + "tokenizer": "whitespace", + "filter": [ "synonym" ] + } + }, + "filter": { + "synonym": { + "type": "synonym_graph", + "synonyms_path": "analysis/synonym.txt", <1> + "updateable": true <2> + } } + } } + }, + "mappings": { + "properties": { + "text": { + "type": "text", + "analyzer": "standard", + "search_analyzer": "my_synonyms" <3> + } + } + } } -------------------------------------------------- @@ -153,25 +153,25 @@ The API returns the following response. [source,console-result] -------------------------------------------------- { - "_shards" : { - "total" : 2, - "successful" : 2, - "failed" : 0 - }, - "reload_details" : [ - { - "index" : "my_index", - "reloaded_analyzers" : [ - "my_synonyms" - ], - "reloaded_node_ids" : [ - "mfdqTXn_T7SGr2Ho2KT8uw" - ] - } - ] + "_shards": { + "total": 2, + "successful": 2, + "failed": 0 + }, + "reload_details": [ + { + "index": "my_index", + "reloaded_analyzers": [ + "my_synonyms" + ], + "reloaded_node_ids": [ + "mfdqTXn_T7SGr2Ho2KT8uw" + ] + } + ] } -------------------------------------------------- // TEST[continued] -// TESTRESPONSE[s/"total" : 2/"total" : $body._shards.total/] -// TESTRESPONSE[s/"successful" : 2/"successful" : $body._shards.successful/] +// TESTRESPONSE[s/"total": 2/"total": $body._shards.total/] +// TESTRESPONSE[s/"successful": 2/"successful": $body._shards.successful/] // TESTRESPONSE[s/mfdqTXn_T7SGr2Ho2KT8uw/$body.reload_details.0.reloaded_node_ids.0/] diff --git a/docs/reference/indices/close.asciidoc b/docs/reference/indices/close.asciidoc index fe657c77aa1..71b93c0eb7d 100644 --- a/docs/reference/indices/close.asciidoc +++ b/docs/reference/indices/close.asciidoc @@ -73,12 +73,12 @@ The API returns following response: [source,console-result] -------------------------------------------------- { - "acknowledged" : true, - "shards_acknowledged" : true, - "indices" : { - "my_index" : { - "closed" : true - } + "acknowledged": true, + "shards_acknowledged": true, + "indices": { + "my_index": { + "closed": true } + } } -------------------------------------------------- diff --git a/docs/reference/indices/create-index.asciidoc b/docs/reference/indices/create-index.asciidoc index f234c2fdc5f..cc75457b859 100644 --- a/docs/reference/indices/create-index.asciidoc +++ b/docs/reference/indices/create-index.asciidoc @@ -83,12 +83,12 @@ associated with it, defined in the body: -------------------------------------------------- PUT /twitter { - "settings" : { - "index" : { - "number_of_shards" : 3, <1> - "number_of_replicas" : 2 <2> - } + "settings": { + "index": { + "number_of_shards": 3, <1> + "number_of_replicas": 2 <2> } + } } -------------------------------------------------- @@ -101,10 +101,10 @@ or more simplified -------------------------------------------------- PUT /twitter { - "settings" : { - "number_of_shards" : 3, - "number_of_replicas" : 2 - } + "settings": { + "number_of_shards": 3, + "number_of_replicas": 2 + } } -------------------------------------------------- @@ -125,14 +125,14 @@ The create index API allows for providing a mapping definition: -------------------------------------------------- PUT /test { - "settings" : { - "number_of_shards" : 1 - }, - "mappings" : { - "properties" : { - "field1" : { "type" : "text" } - } + "settings": { + "number_of_shards": 1 + }, + "mappings": { + "properties": { + "field1": { "type": "text" } } + } } -------------------------------------------------- @@ -149,15 +149,15 @@ The create index API allows also to provide a set of <> -------------------------------------------------- PUT /test { - "aliases" : { - "alias_1" : {}, - "alias_2" : { - "filter" : { - "term" : {"user" : "kimchy" } - }, - "routing" : "kimchy" - } + "aliases": { + "alias_1": {}, + "alias_2": { + "filter": { + "term": { "user": "kimchy" } + }, + "routing": "kimchy" } + } } -------------------------------------------------- @@ -171,9 +171,9 @@ what happened: [source,console-result] -------------------------------------------------- { - "acknowledged": true, - "shards_acknowledged": true, - "index": "test" + "acknowledged": true, + "shards_acknowledged": true, + "index": "test" } -------------------------------------------------- @@ -196,9 +196,9 @@ the `wait_for_active_shards` value on all subsequent write operations): -------------------------------------------------- PUT /test { - "settings": { - "index.write.wait_for_active_shards": "2" - } + "settings": { + "index.write.wait_for_active_shards": "2" + } } -------------------------------------------------- // TEST[skip:requires two nodes] diff --git a/docs/reference/indices/dangling-index-import.asciidoc b/docs/reference/indices/dangling-index-import.asciidoc index 6129e484ede..c905748216f 100644 --- a/docs/reference/indices/dangling-index-import.asciidoc +++ b/docs/reference/indices/dangling-index-import.asciidoc @@ -60,6 +60,6 @@ The API returns following response: [source,console-result] -------------------------------------------------- { - "acknowledged" : true + "acknowledged" : true } -------------------------------------------------- diff --git a/docs/reference/indices/get-field-mapping.asciidoc b/docs/reference/indices/get-field-mapping.asciidoc index 0b9c86ecf3c..22b01aa2aa2 100644 --- a/docs/reference/indices/get-field-mapping.asciidoc +++ b/docs/reference/indices/get-field-mapping.asciidoc @@ -78,19 +78,19 @@ index with several field mappings. -------------------------------------------------- PUT /publications { - "mappings": { + "mappings": { + "properties": { + "id": { "type": "text" }, + "title": { "type": "text" }, + "abstract": { "type": "text" }, + "author": { "properties": { - "id": { "type": "text" }, - "title": { "type": "text"}, - "abstract": { "type": "text"}, - "author": { - "properties": { - "id": { "type": "text" }, - "name": { "type": "text" } - } - } + "id": { "type": "text" }, + "name": { "type": "text" } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/indices/open-close.asciidoc b/docs/reference/indices/open-close.asciidoc index 660e56771c2..1e08290e4c4 100644 --- a/docs/reference/indices/open-close.asciidoc +++ b/docs/reference/indices/open-close.asciidoc @@ -129,7 +129,7 @@ The API returns the following response: [source,console-result] -------------------------------------------------- { - "acknowledged" : true, - "shards_acknowledged" : true + "acknowledged" : true, + "shards_acknowledged" : true } -------------------------------------------------- diff --git a/docs/reference/indices/put-mapping.asciidoc b/docs/reference/indices/put-mapping.asciidoc index 0037ea03185..c6f34f47c6d 100644 --- a/docs/reference/indices/put-mapping.asciidoc +++ b/docs/reference/indices/put-mapping.asciidoc @@ -443,12 +443,12 @@ with `user_id` field values. ---- POST /users/_doc?refresh=wait_for { - "user_id" : 12345 + "user_id" : 12345 } POST /users/_doc?refresh=wait_for { - "user_id" : 12346 + "user_id" : 12346 } ---- // TEST[continued] diff --git a/docs/reference/indices/segments.asciidoc b/docs/reference/indices/segments.asciidoc index ebbdda99147..261ecf74d34 100644 --- a/docs/reference/indices/segments.asciidoc +++ b/docs/reference/indices/segments.asciidoc @@ -200,27 +200,27 @@ The API returns the following response: [source,console-response] -------------------------------------------------- { - ... - "_0": { + ... + "_0": { + ... + "ram_tree": [ + { + "description": "postings [PerFieldPostings(format=1)]", + "size_in_bytes": 2696, + "children": [ + { + "description": "format 'Lucene50_0' ...", + "size_in_bytes": 2608, + "children" :[ ... ] + }, ... - "ram_tree": [ - { - "description": "postings [PerFieldPostings(format=1)]", - "size_in_bytes": 2696, - "children": [ - { - "description": "format 'Lucene50_0' ...", - "size_in_bytes": 2608, - "children" :[ ... ] - }, - ... - ] - }, - ... - ] + ] + }, + ... + ] - } - ... + } + ... } -------------------------------------------------- // TESTRESPONSE[skip:Response is too verbose to be fully shown in documentation, so we just show the relevant bit and don't test the response.] diff --git a/docs/reference/indices/templates.asciidoc b/docs/reference/indices/templates.asciidoc index 2f0731d6dd7..1a4183435dc 100644 --- a/docs/reference/indices/templates.asciidoc +++ b/docs/reference/indices/templates.asciidoc @@ -146,20 +146,20 @@ You can include <> in an index template. -------------------------------------------------- PUT _template/template_1 { - "index_patterns" : ["te*"], - "settings" : { - "number_of_shards" : 1 + "index_patterns" : ["te*"], + "settings" : { + "number_of_shards" : 1 + }, + "aliases" : { + "alias1" : {}, + "alias2" : { + "filter" : { + "term" : {"user" : "kimchy" } + }, + "routing" : "kimchy" }, - "aliases" : { - "alias1" : {}, - "alias2" : { - "filter" : { - "term" : {"user" : "kimchy" } - }, - "routing" : "kimchy" - }, - "{index}-alias" : {} <1> - } + "{index}-alias" : {} <1> + } } -------------------------------------------------- @@ -180,26 +180,26 @@ orders overriding them. For example: -------------------------------------------------- PUT /_template/template_1 { - "index_patterns" : ["te*"], - "order" : 0, - "settings" : { - "number_of_shards" : 1 - }, - "mappings" : { - "_source" : { "enabled" : false } - } + "index_patterns" : ["te*"], + "order" : 0, + "settings" : { + "number_of_shards" : 1 + }, + "mappings" : { + "_source" : { "enabled" : false } + } } PUT /_template/template_2 { - "index_patterns" : ["tes*"], - "order" : 1, - "settings" : { - "number_of_shards" : 1 - }, - "mappings" : { - "_source" : { "enabled" : true } - } + "index_patterns" : ["tes*"], + "order" : 1, + "settings" : { + "number_of_shards" : 1 + }, + "mappings" : { + "_source" : { "enabled" : true } + } } -------------------------------------------------- @@ -231,12 +231,12 @@ replace the template without specifying one. -------------------------------------------------- PUT /_template/template_1 { - "index_patterns" : ["myindex-*"], - "order" : 0, - "settings" : { - "number_of_shards" : 1 - }, - "version": 123 + "index_patterns" : ["myindex-*"], + "order" : 0, + "settings" : { + "number_of_shards" : 1 + }, + "version": 123 } -------------------------------------------------- diff --git a/docs/reference/indices/update-settings.asciidoc b/docs/reference/indices/update-settings.asciidoc index 98bd114254c..bb3edec2c5c 100644 --- a/docs/reference/indices/update-settings.asciidoc +++ b/docs/reference/indices/update-settings.asciidoc @@ -13,9 +13,9 @@ default. -------------------------------------------------- PUT /twitter/_settings { - "index" : { - "number_of_replicas" : 2 - } + "index" : { + "number_of_replicas" : 2 + } } -------------------------------------------------- // TEST[setup:twitter] @@ -79,9 +79,9 @@ To revert a setting to the default value, use `null`. For example: -------------------------------------------------- PUT /twitter/_settings { - "index" : { - "refresh_interval" : null - } + "index" : { + "refresh_interval" : null + } } -------------------------------------------------- // TEST[setup:twitter] @@ -103,9 +103,9 @@ use: -------------------------------------------------- PUT /twitter/_settings { - "index" : { - "refresh_interval" : "-1" - } + "index" : { + "refresh_interval" : "-1" + } } -------------------------------------------------- // TEST[setup:twitter] @@ -120,9 +120,9 @@ the defaults for example): -------------------------------------------------- PUT /twitter/_settings { - "index" : { - "refresh_interval" : "1s" - } + "index" : { + "refresh_interval" : "1s" + } } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/ingest/apis/enrich/delete-enrich-policy.asciidoc b/docs/reference/ingest/apis/enrich/delete-enrich-policy.asciidoc index 7b09aec3ca7..cc26030369d 100644 --- a/docs/reference/ingest/apis/enrich/delete-enrich-policy.asciidoc +++ b/docs/reference/ingest/apis/enrich/delete-enrich-policy.asciidoc @@ -14,20 +14,20 @@ Deletes an existing <> and its ---- PUT /users { - "mappings" : { - "properties" : { - "email" : { "type" : "keyword" } - } + "mappings": { + "properties": { + "email": { "type": "keyword" } } + } } PUT /_enrich/policy/my-policy { - "match": { - "indices": "users", - "match_field": "email", - "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] - } + "match": { + "indices": "users", + "match_field": "email", + "enrich_fields": [ "first_name", "last_name", "city", "zip", "state" ] + } } ---- // TESTSETUP diff --git a/docs/reference/ingest/apis/enrich/enrich-stats.asciidoc b/docs/reference/ingest/apis/enrich/enrich-stats.asciidoc index c6323753687..f7bc9680db6 100644 --- a/docs/reference/ingest/apis/enrich/enrich-stats.asciidoc +++ b/docs/reference/ingest/apis/enrich/enrich-stats.asciidoc @@ -101,32 +101,32 @@ The API returns the following response: [source,console-result] ---- { - "executing_policies": [ - { - "name": "my-policy", - "task": { - "id" : 124, - "type" : "direct", - "action" : "cluster:admin/xpack/enrich/execute", - "start_time_in_millis" : 1458585884904, - "running_time_in_nanos" : 47402, - "cancellable" : false, - "parent_task_id" : "oTUltX4IQMOUUVeiohTt8A:123", - "headers" : { - "X-Opaque-Id" : "123456" - } - } + "executing_policies": [ + { + "name": "my-policy", + "task": { + "id": 124, + "type": "direct", + "action": "cluster:admin/xpack/enrich/execute", + "start_time_in_millis": 1458585884904, + "running_time_in_nanos": 47402, + "cancellable": false, + "parent_task_id": "oTUltX4IQMOUUVeiohTt8A:123", + "headers": { + "X-Opaque-Id": "123456" } - ], - "coordinator_stats": [ - { - "node_id": "1sFM8cmSROZYhPxVsiWew", - "queue_size": 0, - "remote_requests_current": 0, - "remote_requests_total": 0, - "executed_searches_total": 0 - } - ] + } + } + ], + "coordinator_stats": [ + { + "node_id": "1sFM8cmSROZYhPxVsiWew", + "queue_size": 0, + "remote_requests_current": 0, + "remote_requests_total": 0, + "executed_searches_total": 0 + } + ] } ---- // TESTRESPONSE[s/"executing_policies": \[[^\]]*\]/"executing_policies": $body.$_path/] diff --git a/docs/reference/ingest/apis/enrich/execute-enrich-policy.asciidoc b/docs/reference/ingest/apis/enrich/execute-enrich-policy.asciidoc index 155287cd125..4635d03b9ec 100644 --- a/docs/reference/ingest/apis/enrich/execute-enrich-policy.asciidoc +++ b/docs/reference/ingest/apis/enrich/execute-enrich-policy.asciidoc @@ -14,23 +14,23 @@ Executes an existing <>. ---- PUT /users/_doc/1?refresh { - "email": "mardy.brown@asciidocsmith.com", - "first_name": "Mardy", - "last_name": "Brown", - "city": "New Orleans", - "county": "Orleans", - "state": "LA", - "zip": 70116, - "web": "mardy.asciidocsmith.com" + "email": "mardy.brown@asciidocsmith.com", + "first_name": "Mardy", + "last_name": "Brown", + "city": "New Orleans", + "county": "Orleans", + "state": "LA", + "zip": 70116, + "web": "mardy.asciidocsmith.com" } PUT /_enrich/policy/my-policy { - "match": { - "indices": "users", - "match_field": "email", - "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] - } + "match": { + "indices": "users", + "match_field": "email", + "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] + } } ---- // TESTSETUP diff --git a/docs/reference/ingest/apis/enrich/get-enrich-policy.asciidoc b/docs/reference/ingest/apis/enrich/get-enrich-policy.asciidoc index dc1459b98de..7d32d889629 100644 --- a/docs/reference/ingest/apis/enrich/get-enrich-policy.asciidoc +++ b/docs/reference/ingest/apis/enrich/get-enrich-policy.asciidoc @@ -13,29 +13,29 @@ Returns information about an <>. ---- PUT /users { - "mappings" : { - "properties" : { - "email" : { "type" : "keyword" } - } + "mappings" : { + "properties" : { + "email" : { "type" : "keyword" } } + } } PUT /_enrich/policy/my-policy { - "match": { - "indices": "users", - "match_field": "email", - "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] - } + "match": { + "indices": "users", + "match_field": "email", + "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] + } } PUT /_enrich/policy/other-policy { - "match": { - "indices": "users", - "match_field": "email", - "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] - } + "match": { + "indices": "users", + "match_field": "email", + "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] + } } ---- //// @@ -96,24 +96,24 @@ The API returns the following response: [source,console-result] -------------------------------------------------- { - "policies": [ - { - "config": { - "match": { - "name" : "my-policy", - "indices" : ["users"], - "match_field" : "email", - "enrich_fields" : [ - "first_name", - "last_name", - "city", - "zip", - "state" - ] - } - } + "policies": [ + { + "config": { + "match": { + "name": "my-policy", + "indices": [ "users" ], + "match_field": "email", + "enrich_fields": [ + "first_name", + "last_name", + "city", + "zip", + "state" + ] } - ] + } + } + ] } -------------------------------------------------- @@ -132,40 +132,40 @@ The API returns the following response: [source,js] -------------------------------------------------- { - "policies": [ - { - "config": { - "match": { - "name" : "my-policy", - "indices" : ["users"], - "match_field" : "email", - "enrich_fields" : [ - "first_name", - "last_name", - "city", - "zip", - "state" - ] - } - } - }, - { - "config": { - "match": { - "name" : "other-policy", - "indices" : ["users"], - "match_field" : "email", - "enrich_fields" : [ - "first_name", - "last_name", - "city", - "zip", - "state" - ] - } - } + "policies": [ + { + "config": { + "match": { + "name": "my-policy", + "indices": [ "users" ], + "match_field": "email", + "enrich_fields": [ + "first_name", + "last_name", + "city", + "zip", + "state" + ] } - ] + } + }, + { + "config": { + "match": { + "name": "other-policy", + "indices": [ "users" ], + "match_field": "email", + "enrich_fields": [ + "first_name", + "last_name", + "city", + "zip", + "state" + ] + } + } + } + ] } -------------------------------------------------- // TESTRESPONSE @@ -185,40 +185,40 @@ The API returns the following response: [source,console-result] -------------------------------------------------- { - "policies": [ - { - "config": { - "match": { - "name" : "my-policy", - "indices" : ["users"], - "match_field" : "email", - "enrich_fields" : [ - "first_name", - "last_name", - "city", - "zip", - "state" - ] - } - } - }, - { - "config": { - "match": { - "name" : "other-policy", - "indices" : ["users"], - "match_field" : "email", - "enrich_fields" : [ - "first_name", - "last_name", - "city", - "zip", - "state" - ] - } - } + "policies": [ + { + "config": { + "match": { + "name": "my-policy", + "indices": [ "users" ], + "match_field": "email", + "enrich_fields": [ + "first_name", + "last_name", + "city", + "zip", + "state" + ] } - ] + } + }, + { + "config": { + "match": { + "name": "other-policy", + "indices": [ "users" ], + "match_field": "email", + "enrich_fields": [ + "first_name", + "last_name", + "city", + "zip", + "state" + ] + } + } + } + ] } -------------------------------------------------- diff --git a/docs/reference/ingest/apis/enrich/put-enrich-policy.asciidoc b/docs/reference/ingest/apis/enrich/put-enrich-policy.asciidoc index b9842f46363..f001e3f2065 100644 --- a/docs/reference/ingest/apis/enrich/put-enrich-policy.asciidoc +++ b/docs/reference/ingest/apis/enrich/put-enrich-policy.asciidoc @@ -13,11 +13,11 @@ Creates an enrich policy. ---- PUT /users { - "mappings" : { - "properties" : { - "email" : { "type" : "keyword" } - } + "mappings": { + "properties": { + "email": { "type": "keyword" } } + } } ---- //// @@ -26,11 +26,11 @@ PUT /users ---- PUT /_enrich/policy/my-policy { - "match": { - "indices": "users", - "match_field": "email", - "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] - } + "match": { + "indices": "users", + "match_field": "email", + "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] + } } ---- // TEST[continued] diff --git a/docs/reference/ingest/enrich.asciidoc b/docs/reference/ingest/enrich.asciidoc index b88f9eee27c..0ab4307077f 100644 --- a/docs/reference/ingest/enrich.asciidoc +++ b/docs/reference/ingest/enrich.asciidoc @@ -243,12 +243,11 @@ following: [source,js] ---- { - "": { - "indices": ["..."], - "match_field": "...", - "enrich_fields": ["..."], - "query": {...} - } + "": { + "indices": [ "..." ], + "match_field": "...", + "enrich_fields": [ "..." ], + "query": {... } } } ---- @@ -321,16 +320,16 @@ containing at least one `geo_shape` field. ---- PUT /postal_codes { - "mappings": { - "properties": { - "location": { - "type": "geo_shape" - }, - "postal_code": { - "type": "keyword" - } - } + "mappings": { + "properties": { + "location": { + "type": "geo_shape" + }, + "postal_code": { + "type": "keyword" + } } + } } ---- @@ -340,11 +339,11 @@ Use the <> to index enrich data to this source index. ---- PUT /postal_codes/_doc/1?refresh=wait_for { - "location": { - "type": "envelope", - "coordinates": [[13.0, 53.0], [14.0, 52.0]] - }, - "postal_code": "96598" + "location": { + "type": "envelope", + "coordinates": [ [ 13.0, 53.0 ], [ 14.0, 52.0 ] ] + }, + "postal_code": "96598" } ---- // TEST[continued] @@ -362,11 +361,11 @@ policy with the `geo_match` policy type. This policy must include: ---- PUT /_enrich/policy/postal_policy { - "geo_match": { - "indices": "postal_codes", - "match_field": "location", - "enrich_fields": ["location","postal_code"] - } + "geo_match": { + "indices": "postal_codes", + "match_field": "location", + "enrich_fields": [ "location", "postal_code" ] + } } ---- // TEST[continued] @@ -419,9 +418,9 @@ include the `field` specified in your enrich processor. ---- PUT /users/_doc/0?pipeline=postal_lookup { - "first_name": "Mardy", - "last_name": "Brown", - "geo_location": "POINT (13.5 52.5)" + "first_name": "Mardy", + "last_name": "Brown", + "geo_location": "POINT (13.5 52.5)" } ---- // TEST[continued] @@ -495,14 +494,14 @@ new document to that index. ---- PUT /users/_doc/1?refresh=wait_for { - "email": "mardy.brown@asciidocsmith.com", - "first_name": "Mardy", - "last_name": "Brown", - "city": "New Orleans", - "county": "Orleans", - "state": "LA", - "zip": 70116, - "web": "mardy.asciidocsmith.com" + "email": "mardy.brown@asciidocsmith.com", + "first_name": "Mardy", + "last_name": "Brown", + "city": "New Orleans", + "county": "Orleans", + "state": "LA", + "zip": 70116, + "web": "mardy.asciidocsmith.com" } ---- @@ -519,11 +518,11 @@ policy type. This policy must include: ---- PUT /_enrich/policy/users-policy { - "match": { - "indices": "users", - "match_field": "email", - "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] - } + "match": { + "indices": "users", + "match_field": "email", + "enrich_fields": ["first_name", "last_name", "city", "zip", "state"] + } } ---- // TEST[continued] diff --git a/docs/reference/ingest/processors/circle.asciidoc b/docs/reference/ingest/processors/circle.asciidoc index bbcf9d5ae1d..5296c5c3f02 100644 --- a/docs/reference/ingest/processors/circle.asciidoc +++ b/docs/reference/ingest/processors/circle.asciidoc @@ -35,16 +35,16 @@ PUT circles PUT _ingest/pipeline/polygonize_circles { - "description": "translate circle to polygon", - "processors": [ - { - "circle": { - "field": "circle", - "error_distance": 28.0, - "shape_type": "geo_shape" - } + "description": "translate circle to polygon", + "processors": [ + { + "circle": { + "field": "circle", + "error_distance": 28.0, + "shape_type": "geo_shape" } - ] + } + ] } -------------------------------------------------- diff --git a/docs/reference/ingest/processors/geoip.asciidoc b/docs/reference/ingest/processors/geoip.asciidoc index 95b65296b31..7115e13e08d 100644 --- a/docs/reference/ingest/processors/geoip.asciidoc +++ b/docs/reference/ingest/processors/geoip.asciidoc @@ -230,22 +230,22 @@ PUT my_ip_locations/_doc/1?refresh=true&pipeline=geoip GET /my_ip_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_distance" : { - "distance" : "1m", - "geoip.location" : { - "lon" : -97.822, - "lat" : 37.751 - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_distance": { + "distance": "1m", + "geoip.location": { + "lon": -97.822, + "lat": 37.751 + } } + } } + } } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/ingest/processors/script.asciidoc b/docs/reference/ingest/processors/script.asciidoc index d9aed04f57d..1f6ad4053e6 100644 --- a/docs/reference/ingest/processors/script.asciidoc +++ b/docs/reference/ingest/processors/script.asciidoc @@ -50,17 +50,17 @@ was provided in the original index request: -------------------------------------------------- PUT _ingest/pipeline/my_index { - "description": "use index:my_index and type:_doc", - "processors": [ - { - "script": { - "source": """ - ctx._index = 'my_index'; - ctx._type = '_doc'; - """ - } + "description": "use index:my_index", + "processors": [ + { + "script": { + "source": """ + ctx._index = 'my_index'; + ctx._type = '_doc'; + """ } - ] + } + ] } -------------------------------------------------- diff --git a/docs/reference/mapping/params/position-increment-gap.asciidoc b/docs/reference/mapping/params/position-increment-gap.asciidoc index 57ecacd034a..340306f80c9 100644 --- a/docs/reference/mapping/params/position-increment-gap.asciidoc +++ b/docs/reference/mapping/params/position-increment-gap.asciidoc @@ -15,30 +15,30 @@ For example: -------------------------------------------------- PUT my_index/_doc/1 { - "names": [ "John Abraham", "Lincoln Smith"] + "names": [ "John Abraham", "Lincoln Smith"] } GET my_index/_search { - "query": { - "match_phrase": { - "names": { - "query": "Abraham Lincoln" <1> - } - } + "query": { + "match_phrase": { + "names": { + "query": "Abraham Lincoln" <1> + } } + } } GET my_index/_search { - "query": { - "match_phrase": { - "names": { - "query": "Abraham Lincoln", - "slop": 101 <2> - } - } + "query": { + "match_phrase": { + "names": { + "query": "Abraham Lincoln", + "slop": 101 <2> + } } + } } -------------------------------------------------- @@ -65,16 +65,16 @@ PUT my_index PUT my_index/_doc/1 { - "names": [ "John Abraham", "Lincoln Smith"] + "names": [ "John Abraham", "Lincoln Smith"] } GET my_index/_search { - "query": { - "match_phrase": { - "names": "Abraham Lincoln" <2> - } + "query": { + "match_phrase": { + "names": "Abraham Lincoln" <2> } + } } -------------------------------------------------- diff --git a/docs/reference/mapping/types/geo-shape.asciidoc b/docs/reference/mapping/types/geo-shape.asciidoc index cfbe6b8294f..6eab4efa944 100644 --- a/docs/reference/mapping/types/geo-shape.asciidoc +++ b/docs/reference/mapping/types/geo-shape.asciidoc @@ -212,13 +212,13 @@ the cell right next to it -- even though the shape is very close to the point. -------------------------------------------------- PUT /example { - "mappings": { - "properties": { - "location": { - "type": "geo_shape" - } - } + "mappings": { + "properties": { + "location": { + "type": "geo_shape" + } } + } } -------------------------------------------------- // TESTSETUP @@ -304,10 +304,10 @@ API. The following is an example of a point in GeoJSON. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "point", - "coordinates" : [-77.03653, 38.897676] - } + "location" : { + "type" : "point", + "coordinates" : [-77.03653, 38.897676] + } } -------------------------------------------------- @@ -317,7 +317,7 @@ The following is an example of a point in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "POINT (-77.03653 38.897676)" + "location" : "POINT (-77.03653 38.897676)" } -------------------------------------------------- @@ -334,10 +334,10 @@ following is an example of a LineString in GeoJSON. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "linestring", - "coordinates" : [[-77.03653, 38.897676], [-77.009051, 38.889939]] - } + "location" : { + "type" : "linestring", + "coordinates" : [[-77.03653, 38.897676], [-77.009051, 38.889939]] + } } -------------------------------------------------- @@ -347,7 +347,7 @@ The following is an example of a LineString in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "LINESTRING (-77.03653 38.897676, -77.009051 38.889939)" + "location" : "LINESTRING (-77.03653 38.897676, -77.009051 38.889939)" } -------------------------------------------------- @@ -366,12 +366,12 @@ closed). The following is an example of a Polygon in GeoJSON. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "coordinates" : [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] - ] - } + "location" : { + "type" : "polygon", + "coordinates" : [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] + ] + } } -------------------------------------------------- @@ -381,7 +381,7 @@ The following is an example of a Polygon in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0))" + "location" : "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0))" } -------------------------------------------------- @@ -393,13 +393,13 @@ of a polygon with a hole: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "coordinates" : [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], - [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] - ] - } + "location" : { + "type" : "polygon", + "coordinates" : [ + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], + [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] + ] + } } -------------------------------------------------- @@ -409,7 +409,7 @@ The following is an example of a Polygon with a hole in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2))" + "location" : "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2))" } -------------------------------------------------- @@ -436,13 +436,13 @@ crosses the dateline. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "coordinates" : [ - [ [-177.0, 10.0], [176.0, 15.0], [172.0, 0.0], [176.0, -15.0], [-177.0, -10.0], [-177.0, 10.0] ], - [ [178.2, 8.2], [-178.8, 8.2], [-180.8, -8.8], [178.2, 8.8] ] - ] - } + "location" : { + "type" : "polygon", + "coordinates" : [ + [ [-177.0, 10.0], [176.0, 15.0], [172.0, 0.0], [176.0, -15.0], [-177.0, -10.0], [-177.0, 10.0] ], + [ [178.2, 8.2], [-178.8, 8.2], [-180.8, -8.8], [178.2, 8.8] ] + ] + } } -------------------------------------------------- // TEST[catch:/mapper_parsing_exception/] @@ -455,13 +455,13 @@ overriding the orientation on a document: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "orientation" : "clockwise", - "coordinates" : [ - [ [100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0], [100.0, 0.0] ] - ] - } + "location" : { + "type" : "polygon", + "orientation" : "clockwise", + "coordinates" : [ + [ [100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0], [100.0, 0.0] ] + ] + } } -------------------------------------------------- @@ -475,12 +475,12 @@ The following is an example of a list of geojson points: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "multipoint", - "coordinates" : [ - [102.0, 2.0], [103.0, 2.0] - ] - } + "location" : { + "type" : "multipoint", + "coordinates" : [ + [102.0, 2.0], [103.0, 2.0] + ] + } } -------------------------------------------------- @@ -490,7 +490,7 @@ The following is an example of a list of WKT points: -------------------------------------------------- POST /example/_doc { - "location" : "MULTIPOINT (102.0 2.0, 103.0 2.0)" + "location" : "MULTIPOINT (102.0 2.0, 103.0 2.0)" } -------------------------------------------------- @@ -504,14 +504,14 @@ The following is an example of a list of geojson linestrings: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "multilinestring", - "coordinates" : [ - [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0] ], - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0] ], - [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8] ] - ] - } + "location" : { + "type" : "multilinestring", + "coordinates" : [ + [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0] ], + [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0] ], + [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8] ] + ] + } } -------------------------------------------------- @@ -521,7 +521,7 @@ The following is an example of a list of WKT linestrings: -------------------------------------------------- POST /example/_doc { - "location" : "MULTILINESTRING ((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0), (100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8))" + "location" : "MULTILINESTRING ((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0), (100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8))" } -------------------------------------------------- @@ -535,14 +535,14 @@ The following is an example of a list of geojson polygons (second polygon contai -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "multipolygon", - "coordinates" : [ - [ [[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]] ], - [ [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], - [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] ] - ] - } + "location" : { + "type" : "multipolygon", + "coordinates" : [ + [ [[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]] ], + [ [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], + [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] ] + ] + } } -------------------------------------------------- @@ -552,7 +552,7 @@ The following is an example of a list of WKT polygons (second polygon contains a -------------------------------------------------- POST /example/_doc { - "location" : "MULTIPOLYGON (((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0, 102.0 2.0)), ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2)))" + "location" : "MULTIPOLYGON (((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0, 102.0 2.0)), ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2)))" } -------------------------------------------------- @@ -566,19 +566,19 @@ The following is an example of a collection of geojson geometry objects: -------------------------------------------------- POST /example/_doc { - "location" : { - "type": "geometrycollection", - "geometries": [ - { - "type": "point", - "coordinates": [100.0, 0.0] - }, - { - "type": "linestring", - "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] - } - ] - } + "location" : { + "type": "geometrycollection", + "geometries": [ + { + "type": "point", + "coordinates": [100.0, 0.0] + }, + { + "type": "linestring", + "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] + } + ] + } } -------------------------------------------------- @@ -588,7 +588,7 @@ The following is an example of a collection of WKT geometry objects: -------------------------------------------------- POST /example/_doc { - "location" : "GEOMETRYCOLLECTION (POINT (100.0 0.0), LINESTRING (101.0 0.0, 102.0 1.0))" + "location" : "GEOMETRYCOLLECTION (POINT (100.0 0.0), LINESTRING (101.0 0.0, 102.0 1.0))" } -------------------------------------------------- @@ -604,10 +604,10 @@ bounding rectangle in the format `[[minLon, maxLat], [maxLon, minLat]]`: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "envelope", - "coordinates" : [ [100.0, 1.0], [101.0, 0.0] ] - } + "location" : { + "type" : "envelope", + "coordinates" : [ [100.0, 1.0], [101.0, 0.0] ] + } } -------------------------------------------------- @@ -619,7 +619,7 @@ The following is an example of an envelope using the WKT BBOX format: -------------------------------------------------- POST /example/_doc { - "location" : "BBOX (100.0, 102.0, 2.0, 0.0)" + "location" : "BBOX (100.0, 102.0, 2.0, 0.0)" } -------------------------------------------------- @@ -636,11 +636,11 @@ a `POLYGON`. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "circle", - "coordinates" : [101.0, 1.0], - "radius" : "100m" - } + "location" : { + "type" : "circle", + "coordinates" : [101.0, 1.0], + "radius" : "100m" + } } -------------------------------------------------- // TEST[skip:not supported in default] diff --git a/docs/reference/mapping/types/parent-join.asciidoc b/docs/reference/mapping/types/parent-join.asciidoc index 176df843d2c..94c750efeda 100644 --- a/docs/reference/mapping/types/parent-join.asciidoc +++ b/docs/reference/mapping/types/parent-join.asciidoc @@ -178,80 +178,80 @@ Will return: [source,console-result] -------------------------------------------------- { - ..., - "hits": { - "total" : { - "value": 4, - "relation": "eq" + ..., + "hits": { + "total": { + "value": 4, + "relation": "eq" + }, + "max_score": null, + "hits": [ + { + "_index": "my_index", + "_type": "_doc", + "_id": "1", + "_score": null, + "_source": { + "my_id": "1", + "text": "This is a question", + "my_join_field": "question" <1> }, - "max_score": null, - "hits": [ - { - "_index": "my_index", - "_type": "_doc", - "_id": "1", - "_score": null, - "_source": { - "my_id": "1", - "text": "This is a question", - "my_join_field": "question" <1> - }, - "sort": [ - "1" - ] - }, - { - "_index": "my_index", - "_type": "_doc", - "_id": "2", - "_score": null, - "_source": { - "my_id": "2", - "text": "This is another question", - "my_join_field": "question" <2> - }, - "sort": [ - "2" - ] - }, - { - "_index": "my_index", - "_type": "_doc", - "_id": "3", - "_score": null, - "_routing": "1", - "_source": { - "my_id": "3", - "text": "This is an answer", - "my_join_field": { - "name": "answer", <3> - "parent": "1" <4> - } - }, - "sort": [ - "3" - ] - }, - { - "_index": "my_index", - "_type": "_doc", - "_id": "4", - "_score": null, - "_routing": "1", - "_source": { - "my_id": "4", - "text": "This is another answer", - "my_join_field": { - "name": "answer", - "parent": "1" - } - }, - "sort": [ - "4" - ] - } + "sort": [ + "1" ] - } + }, + { + "_index": "my_index", + "_type": "_doc", + "_id": "2", + "_score": null, + "_source": { + "my_id": "2", + "text": "This is another question", + "my_join_field": "question" <2> + }, + "sort": [ + "2" + ] + }, + { + "_index": "my_index", + "_type": "_doc", + "_id": "3", + "_score": null, + "_routing": "1", + "_source": { + "my_id": "3", + "text": "This is an answer", + "my_join_field": { + "name": "answer", <3> + "parent": "1" <4> + } + }, + "sort": [ + "3" + ] + }, + { + "_index": "my_index", + "_type": "_doc", + "_id": "4", + "_score": null, + "_routing": "1", + "_source": { + "my_id": "4", + "text": "This is another answer", + "my_join_field": { + "name": "answer", + "parent": "1" + } + }, + "sort": [ + "4" + ] + } + ] + } } -------------------------------------------------- // TESTRESPONSE[s/\.\.\./"timed_out": false, "took": $body.took, "_shards": $body._shards/] diff --git a/docs/reference/mapping/types/percolator.asciidoc b/docs/reference/mapping/types/percolator.asciidoc index cd958c6fe23..2967cdc694d 100644 --- a/docs/reference/mapping/types/percolator.asciidoc +++ b/docs/reference/mapping/types/percolator.asciidoc @@ -20,16 +20,16 @@ If the following mapping configures the `percolator` field type for the -------------------------------------------------- PUT my_index { - "mappings": { - "properties": { - "query": { - "type": "percolator" - }, - "field": { - "type": "text" - } - } + "mappings": { + "properties": { + "query": { + "type": "percolator" + }, + "field": { + "type": "text" + } } + } } -------------------------------------------------- // TESTSETUP @@ -40,11 +40,11 @@ Then you can index a query: -------------------------------------------------- PUT my_index/_doc/match_value { - "query" : { - "match" : { - "field" : "value" - } + "query": { + "match": { + "field": "value" } + } } -------------------------------------------------- diff --git a/docs/reference/mapping/types/shape.asciidoc b/docs/reference/mapping/types/shape.asciidoc index c8d10dcd4c2..dd034e3d98b 100644 --- a/docs/reference/mapping/types/shape.asciidoc +++ b/docs/reference/mapping/types/shape.asciidoc @@ -77,13 +77,13 @@ for indices created with ElasticSearch 7.5.0 or higher. -------------------------------------------------- PUT /example { - "mappings": { - "properties": { - "geometry": { - "type": "shape" - } - } + "mappings": { + "properties": { + "geometry": { + "type": "shape" + } } + } } -------------------------------------------------- // TESTSETUP @@ -141,10 +141,10 @@ following is an example of a point in GeoJSON. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "point", - "coordinates" : [-377.03653, 389.897676] - } + "location" : { + "type" : "point", + "coordinates" : [-377.03653, 389.897676] + } } -------------------------------------------------- @@ -154,7 +154,7 @@ The following is an example of a point in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "POINT (-377.03653 389.897676)" + "location" : "POINT (-377.03653 389.897676)" } -------------------------------------------------- @@ -171,10 +171,10 @@ following is an example of a LineString in GeoJSON. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "linestring", - "coordinates" : [[-377.03653, 389.897676], [-377.009051, 389.889939]] - } + "location" : { + "type" : "linestring", + "coordinates" : [[-377.03653, 389.897676], [-377.009051, 389.889939]] + } } -------------------------------------------------- @@ -184,7 +184,7 @@ The following is an example of a LineString in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "LINESTRING (-377.03653 389.897676, -377.009051 389.889939)" + "location" : "LINESTRING (-377.03653 389.897676, -377.009051 389.889939)" } -------------------------------------------------- @@ -200,12 +200,12 @@ closed). The following is an example of a Polygon in GeoJSON. -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "coordinates" : [ - [ [1000.0, -1001.0], [1001.0, -1001.0], [1001.0, -1000.0], [1000.0, -1000.0], [1000.0, -1001.0] ] - ] - } + "location" : { + "type" : "polygon", + "coordinates" : [ + [ [1000.0, -1001.0], [1001.0, -1001.0], [1001.0, -1000.0], [1000.0, -1000.0], [1000.0, -1001.0] ] + ] + } } -------------------------------------------------- @@ -215,7 +215,7 @@ The following is an example of a Polygon in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "POLYGON ((1000.0 -1001.0, 1001.0 -1001.0, 1001.0 -1000.0, 1000.0 -1000.0, 1000.0 -1001.0))" + "location" : "POLYGON ((1000.0 -1001.0, 1001.0 -1001.0, 1001.0 -1000.0, 1000.0 -1000.0, 1000.0 -1001.0))" } -------------------------------------------------- @@ -227,13 +227,13 @@ of a polygon with a hole: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "coordinates" : [ - [ [1000.0, -1001.0], [1001.0, -1001.0], [1001.0, -1000.0], [1000.0, -1000.0], [1000.0, -1001.0] ], - [ [1000.2, -1001.2], [1000.8, -1001.2], [1000.8, -1001.8], [1000.2, -1001.8], [1000.2, -1001.2] ] - ] - } + "location" : { + "type" : "polygon", + "coordinates" : [ + [ [1000.0, -1001.0], [1001.0, -1001.0], [1001.0, -1000.0], [1000.0, -1000.0], [1000.0, -1001.0] ], + [ [1000.2, -1001.2], [1000.8, -1001.2], [1000.8, -1001.8], [1000.2, -1001.8], [1000.2, -1001.2] ] + ] + } } -------------------------------------------------- @@ -243,7 +243,7 @@ The following is an example of a Polygon with a hole in WKT: -------------------------------------------------- POST /example/_doc { - "location" : "POLYGON ((1000.0 1000.0, 1001.0 1000.0, 1001.0 1001.0, 1000.0 1001.0, 1000.0 1000.0), (1000.2 1000.2, 1000.8 1000.2, 1000.8 1000.8, 1000.2 1000.8, 1000.2 1000.2))" + "location" : "POLYGON ((1000.0 1000.0, 1001.0 1000.0, 1001.0 1001.0, 1000.0 1001.0, 1000.0 1000.0), (1000.2 1000.2, 1000.8 1000.2, 1000.8 1000.8, 1000.2 1000.8, 1000.2 1000.2))" } -------------------------------------------------- @@ -265,13 +265,13 @@ The following is an example of overriding the `orientation` parameters on a docu -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "polygon", - "orientation" : "clockwise", - "coordinates" : [ - [ [1000.0, 1000.0], [1000.0, 1001.0], [1001.0, 1001.0], [1001.0, 1000.0], [1000.0, 1000.0] ] - ] - } + "location" : { + "type" : "polygon", + "orientation" : "clockwise", + "coordinates" : [ + [ [1000.0, 1000.0], [1000.0, 1001.0], [1001.0, 1001.0], [1001.0, 1000.0], [1000.0, 1000.0] ] + ] + } } -------------------------------------------------- @@ -285,12 +285,12 @@ The following is an example of a list of geojson points: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "multipoint", - "coordinates" : [ - [1002.0, 1002.0], [1003.0, 2000.0] - ] - } + "location" : { + "type" : "multipoint", + "coordinates" : [ + [1002.0, 1002.0], [1003.0, 2000.0] + ] + } } -------------------------------------------------- @@ -300,7 +300,7 @@ The following is an example of a list of WKT points: -------------------------------------------------- POST /example/_doc { - "location" : "MULTIPOINT (1002.0 2000.0, 1003.0 2000.0)" + "location" : "MULTIPOINT (1002.0 2000.0, 1003.0 2000.0)" } -------------------------------------------------- @@ -314,14 +314,14 @@ The following is an example of a list of geojson linestrings: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "multilinestring", - "coordinates" : [ - [ [1002.0, 200.0], [1003.0, 200.0], [1003.0, 300.0], [1002.0, 300.0] ], - [ [1000.0, 100.0], [1001.0, 100.0], [1001.0, 100.0], [1000.0, 100.0] ], - [ [1000.2, 100.2], [1000.8, 100.2], [1000.8, 100.8], [1000.2, 100.8] ] - ] - } + "location" : { + "type" : "multilinestring", + "coordinates" : [ + [ [1002.0, 200.0], [1003.0, 200.0], [1003.0, 300.0], [1002.0, 300.0] ], + [ [1000.0, 100.0], [1001.0, 100.0], [1001.0, 100.0], [1000.0, 100.0] ], + [ [1000.2, 100.2], [1000.8, 100.2], [1000.8, 100.8], [1000.2, 100.8] ] + ] + } } -------------------------------------------------- @@ -331,7 +331,7 @@ The following is an example of a list of WKT linestrings: -------------------------------------------------- POST /example/_doc { - "location" : "MULTILINESTRING ((1002.0 200.0, 1003.0 200.0, 1003.0 300.0, 1002.0 300.0), (1000.0 100.0, 1001.0 100.0, 1001.0 100.0, 1000.0 100.0), (1000.2 0.2, 1000.8 100.2, 1000.8 100.8, 1000.2 100.8))" + "location" : "MULTILINESTRING ((1002.0 200.0, 1003.0 200.0, 1003.0 300.0, 1002.0 300.0), (1000.0 100.0, 1001.0 100.0, 1001.0 100.0, 1000.0 100.0), (1000.2 0.2, 1000.8 100.2, 1000.8 100.8, 1000.2 100.8))" } -------------------------------------------------- @@ -345,14 +345,14 @@ The following is an example of a list of geojson polygons (second polygon contai -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "multipolygon", - "coordinates" : [ - [ [[1002.0, 200.0], [1003.0, 200.0], [1003.0, 300.0], [1002.0, 300.0], [1002.0, 200.0]] ], - [ [[1000.0, 200.0], [1001.0, 100.0], [1001.0, 100.0], [1000.0, 100.0], [1000.0, 100.0]], - [[1000.2, 200.2], [1000.8, 100.2], [1000.8, 100.8], [1000.2, 100.8], [1000.2, 100.2]] ] - ] - } + "location" : { + "type" : "multipolygon", + "coordinates" : [ + [ [[1002.0, 200.0], [1003.0, 200.0], [1003.0, 300.0], [1002.0, 300.0], [1002.0, 200.0]] ], + [ [[1000.0, 200.0], [1001.0, 100.0], [1001.0, 100.0], [1000.0, 100.0], [1000.0, 100.0]], + [[1000.2, 200.2], [1000.8, 100.2], [1000.8, 100.8], [1000.2, 100.8], [1000.2, 100.2]] ] + ] + } } -------------------------------------------------- @@ -362,7 +362,7 @@ The following is an example of a list of WKT polygons (second polygon contains a -------------------------------------------------- POST /example/_doc { - "location" : "MULTIPOLYGON (((1002.0 200.0, 1003.0 200.0, 1003.0 300.0, 1002.0 300.0, 102.0 200.0)), ((1000.0 100.0, 1001.0 100.0, 1001.0 100.0, 1000.0 100.0, 1000.0 100.0), (1000.2 100.2, 1000.8 100.2, 1000.8 100.8, 1000.2 100.8, 1000.2 100.2)))" + "location" : "MULTIPOLYGON (((1002.0 200.0, 1003.0 200.0, 1003.0 300.0, 1002.0 300.0, 102.0 200.0)), ((1000.0 100.0, 1001.0 100.0, 1001.0 100.0, 1000.0 100.0, 1000.0 100.0), (1000.2 100.2, 1000.8 100.2, 1000.8 100.8, 1000.2 100.8, 1000.2 100.2)))" } -------------------------------------------------- @@ -376,19 +376,19 @@ The following is an example of a collection of geojson geometry objects: -------------------------------------------------- POST /example/_doc { - "location" : { - "type": "geometrycollection", - "geometries": [ - { - "type": "point", - "coordinates": [1000.0, 100.0] - }, - { - "type": "linestring", - "coordinates": [ [1001.0, 100.0], [1002.0, 100.0] ] - } - ] - } + "location" : { + "type": "geometrycollection", + "geometries": [ + { + "type": "point", + "coordinates": [1000.0, 100.0] + }, + { + "type": "linestring", + "coordinates": [ [1001.0, 100.0], [1002.0, 100.0] ] + } + ] + } } -------------------------------------------------- @@ -398,7 +398,7 @@ The following is an example of a collection of WKT geometry objects: -------------------------------------------------- POST /example/_doc { - "location" : "GEOMETRYCOLLECTION (POINT (1000.0 100.0), LINESTRING (1001.0 100.0, 1002.0 100.0))" + "location" : "GEOMETRYCOLLECTION (POINT (1000.0 100.0), LINESTRING (1001.0 100.0, 1002.0 100.0))" } -------------------------------------------------- @@ -413,10 +413,10 @@ bounding rectangle in the format `[[minX, maxY], [maxX, minY]]`: -------------------------------------------------- POST /example/_doc { - "location" : { - "type" : "envelope", - "coordinates" : [ [1000.0, 100.0], [1001.0, 100.0] ] - } + "location" : { + "type" : "envelope", + "coordinates" : [ [1000.0, 100.0], [1001.0, 100.0] ] + } } -------------------------------------------------- @@ -428,7 +428,7 @@ The following is an example of an envelope using the WKT BBOX format: -------------------------------------------------- POST /example/_doc { - "location" : "BBOX (1000.0, 1002.0, 2000.0, 1000.0)" + "location" : "BBOX (1000.0, 1002.0, 2000.0, 1000.0)" } -------------------------------------------------- diff --git a/docs/reference/ml/anomaly-detection/apis/estimate-model-memory.asciidoc b/docs/reference/ml/anomaly-detection/apis/estimate-model-memory.asciidoc index 359310ec3bc..6acedec9fca 100644 --- a/docs/reference/ml/anomaly-detection/apis/estimate-model-memory.asciidoc +++ b/docs/reference/ml/anomaly-detection/apis/estimate-model-memory.asciidoc @@ -60,26 +60,26 @@ no effect on the estimation. + -------------------------------------------------- POST _ml/anomaly_detectors/_estimate_model_memory { - "analysis_config": { - "bucket_span": "5m", - "detectors": [ - { - "function": "sum", - "field_name": "bytes", - "by_field_name": "status", - "partition_field_name": "app" - } - ], - "influencers": [ "source_ip", "dest_ip" ] - }, - "overall_cardinality": { - "status": 10, - "app": 50 - }, - "max_bucket_cardinality": { - "source_ip": 300, - "dest_ip": 30 - } + "analysis_config": { + "bucket_span": "5m", + "detectors": [ + { + "function": "sum", + "field_name": "bytes", + "by_field_name": "status", + "partition_field_name": "app" + } + ], + "influencers": [ "source_ip", "dest_ip" ] + }, + "overall_cardinality": { + "status": 10, + "app": 50 + }, + "max_bucket_cardinality": { + "source_ip": 300, + "dest_ip": 30 + } } -------------------------------------------------- // TEST[skip:needs-licence] diff --git a/docs/reference/ml/anomaly-detection/apis/validate-job.asciidoc b/docs/reference/ml/anomaly-detection/apis/validate-job.asciidoc index e2dbbc1143c..6cb2d458adb 100644 --- a/docs/reference/ml/anomaly-detection/apis/validate-job.asciidoc +++ b/docs/reference/ml/anomaly-detection/apis/validate-job.asciidoc @@ -41,20 +41,20 @@ The following example validates job configuration information: -------------------------------------------------- POST _ml/anomaly_detectors/_validate { - "description" : "Unusual response times by airlines", - "analysis_config" : { - "bucket_span": "300S", - "detectors" :[ - { - "function": "metric", - "field_name": "responsetime", - "by_field_name": "airline"}], - "influencers": [ "airline" ] - }, - "data_description" : { - "time_field": "time", - "time_format": "yyyy-MM-dd'T'HH:mm:ssX" - } + "description": "Unusual response times by airlines", + "analysis_config": { + "bucket_span": "300S", + "detectors": [ + { + "function": "metric", + "field_name": "responsetime", + "by_field_name": "airline" } ], + "influencers": [ "airline" ] + }, + "data_description": { + "time_field": "time", + "time_format": "yyyy-MM-dd'T'HH:mm:ssX" + } } -------------------------------------------------- // TEST[skip:needs-licence] diff --git a/docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc b/docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc index 0d4a29e7c9f..25df1557e83 100644 --- a/docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc +++ b/docs/reference/ml/df-analytics/apis/get-dfanalytics.asciidoc @@ -189,27 +189,27 @@ The API returns the following results: [source,console-result] ---- { - "count": 1, - "data_frame_analytics": [ - { - "id": "loganalytics", - "source": { - "index": "logdata", - "query": { - "match_all": {} - } - }, - "dest": { - "index": "logdata_out", - "results_field": "ml" - }, - "analysis": { - "outlier_detection": {} - }, - "model_memory_limit": "1gb", - "create_time": 1562265491319, - "version" : "8.0.0" + "count": 1, + "data_frame_analytics": [ + { + "id": "loganalytics", + "source": { + "index": "logdata", + "query": { + "match_all": {} } - ] + }, + "dest": { + "index": "logdata_out", + "results_field": "ml" + }, + "analysis": { + "outlier_detection": {} + }, + "model_memory_limit": "1gb", + "create_time": 1562265491319, + "version": "8.0.0" + } + ] } ---- diff --git a/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc b/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc index b0a397288ce..c02baad09e4 100644 --- a/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc +++ b/docs/reference/ml/df-analytics/apis/put-dfanalytics.asciidoc @@ -494,30 +494,30 @@ The API returns the following result: [source,console-result] ---- { - "id": "loganalytics", - "description": "Outlier detection on log data", - "source": { - "index": ["logdata"], - "query": { - "match_all": {} - } - }, - "dest": { - "index": "logdata_out", - "results_field": "ml" - }, - "analysis": { - "outlier_detection": { - "compute_feature_influence": true, - "outlier_fraction": 0.05, - "standardization_enabled": true - } - }, - "model_memory_limit": "1gb", - "create_time" : 1562265491319, - "version" : "7.6.0", - "allow_lazy_start" : false, - "max_num_threads": 1 + "id": "loganalytics", + "description": "Outlier detection on log data", + "source": { + "index": ["logdata"], + "query": { + "match_all": {} + } + }, + "dest": { + "index": "logdata_out", + "results_field": "ml" + }, + "analysis": { + "outlier_detection": { + "compute_feature_influence": true, + "outlier_fraction": 0.05, + "standardization_enabled": true + } + }, + "model_memory_limit": "1gb", + "create_time" : 1562265491319, + "version" : "7.6.0", + "allow_lazy_start" : false, + "max_num_threads": 1 } ---- // TESTRESPONSE[s/1562265491319/$body.$_path/] diff --git a/docs/reference/monitoring/indices.asciidoc b/docs/reference/monitoring/indices.asciidoc index 2fabed309fe..c0c001dbc46 100644 --- a/docs/reference/monitoring/indices.asciidoc +++ b/docs/reference/monitoring/indices.asciidoc @@ -29,12 +29,12 @@ and the number of replicas to two. ---------------------------------- PUT /_template/custom_monitoring { - "index_patterns": ".monitoring-*", - "order": 1, - "settings": { - "number_of_shards": 5, - "number_of_replicas": 2 - } + "index_patterns": ".monitoring-*", + "order": 1, + "settings": { + "number_of_shards": 5, + "number_of_replicas": 2 + } } ---------------------------------- diff --git a/docs/reference/query-dsl/_query-template.asciidoc b/docs/reference/query-dsl/_query-template.asciidoc index 610978c0d40..9c9af1c8358 100644 --- a/docs/reference/query-dsl/_query-template.asciidoc +++ b/docs/reference/query-dsl/_query-template.asciidoc @@ -40,12 +40,12 @@ Guidelines ---- GET _search { - "query": { - "sample": { - "foo": "baz", - "bar": true - } + "query": { + "sample": { + "foo": "baz", + "bar": true } + } } ---- // TEST[skip: REMOVE THIS COMMENT.] @@ -107,12 +107,12 @@ For example: ---- GET my_time_series_index/_search { - "query": { - "sample": { - "foo": "baz", - "bar": false - } + "query": { + "sample": { + "foo": "baz", + "bar": false } + } } ---- // TEST[skip: REMOVE THIS COMMENT.] \ No newline at end of file diff --git a/docs/reference/query-dsl/boosting-query.asciidoc b/docs/reference/query-dsl/boosting-query.asciidoc index d6427d5d9a2..050ca7746bd 100644 --- a/docs/reference/query-dsl/boosting-query.asciidoc +++ b/docs/reference/query-dsl/boosting-query.asciidoc @@ -18,21 +18,21 @@ excluding them from the search results. ---- GET /_search { - "query": { - "boosting" : { - "positive" : { - "term" : { - "text" : "apple" - } - }, - "negative" : { - "term" : { - "text" : "pie tart fruit crumble tree" - } - }, - "negative_boost" : 0.5 + "query": { + "boosting": { + "positive": { + "term": { + "text": "apple" } + }, + "negative": { + "term": { + "text": "pie tart fruit crumble tree" + } + }, + "negative_boost": 0.5 } + } } ---- diff --git a/docs/reference/query-dsl/constant-score-query.asciidoc b/docs/reference/query-dsl/constant-score-query.asciidoc index 4fc7c1ab7e1..40f4568c313 100644 --- a/docs/reference/query-dsl/constant-score-query.asciidoc +++ b/docs/reference/query-dsl/constant-score-query.asciidoc @@ -12,14 +12,14 @@ parameter value. ---- GET /_search { - "query": { - "constant_score" : { - "filter" : { - "term" : { "user" : "kimchy"} - }, - "boost" : 1.2 - } + "query": { + "constant_score": { + "filter": { + "term": { "user": "kimchy" } + }, + "boost": 1.2 } + } } ---- diff --git a/docs/reference/query-dsl/dis-max-query.asciidoc b/docs/reference/query-dsl/dis-max-query.asciidoc index ff6590eb663..80bc34236a9 100644 --- a/docs/reference/query-dsl/dis-max-query.asciidoc +++ b/docs/reference/query-dsl/dis-max-query.asciidoc @@ -21,16 +21,16 @@ You can use the `dis_max` to search for a term in fields mapped with different ---- GET /_search { - "query": { - "dis_max" : { - "queries" : [ - { "term" : { "title" : "Quick pets" }}, - { "term" : { "body" : "Quick pets" }} - ], - "tie_breaker" : 0.7 - } + "query": { + "dis_max": { + "queries": [ + { "term": { "title": "Quick pets" } }, + { "term": { "body": "Quick pets" } } + ], + "tie_breaker": 0.7 } -} + } +} ---- [[query-dsl-dis-max-query-top-level-params]] diff --git a/docs/reference/query-dsl/exists-query.asciidoc b/docs/reference/query-dsl/exists-query.asciidoc index fd0f13b50ff..cf9dce0709b 100644 --- a/docs/reference/query-dsl/exists-query.asciidoc +++ b/docs/reference/query-dsl/exists-query.asciidoc @@ -20,11 +20,11 @@ An indexed value may not exist for a document's field due to a variety of reason ---- GET /_search { - "query": { - "exists": { - "field": "user" - } + "query": { + "exists": { + "field": "user" } + } } ---- @@ -56,14 +56,14 @@ the `user` field. ---- GET /_search { - "query": { - "bool": { - "must_not": { - "exists": { - "field": "user" - } - } + "query": { + "bool": { + "must_not": { + "exists": { + "field": "user" } + } } + } } ---- diff --git a/docs/reference/query-dsl/function-score-query.asciidoc b/docs/reference/query-dsl/function-score-query.asciidoc index c4924ebd367..8477d9115ba 100644 --- a/docs/reference/query-dsl/function-score-query.asciidoc +++ b/docs/reference/query-dsl/function-score-query.asciidoc @@ -19,14 +19,14 @@ by the query. -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "query": { "match_all": {} }, - "boost": "5", - "random_score": {}, <1> - "boost_mode":"multiply" - } + "query": { + "function_score": { + "query": { "match_all": {} }, + "boost": "5", + "random_score": {}, <1> + "boost_mode": "multiply" } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -41,27 +41,27 @@ given filtering query -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "query": { "match_all": {} }, - "boost": "5", <1> - "functions": [ - { - "filter": { "match": { "test": "bar" } }, - "random_score": {}, <2> - "weight": 23 - }, - { - "filter": { "match": { "test": "cat" } }, - "weight": 42 - } - ], - "max_boost": 42, - "score_mode": "max", - "boost_mode": "multiply", - "min_score" : 42 + "query": { + "function_score": { + "query": { "match_all": {} }, + "boost": "5", <1> + "functions": [ + { + "filter": { "match": { "test": "bar" } }, + "random_score": {}, <2> + "weight": 23 + }, + { + "filter": { "match": { "test": "cat" } }, + "weight": 42 } + ], + "max_boost": 42, + "score_mode": "max", + "boost_mode": "multiply", + "min_score": 42 } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -137,18 +137,18 @@ simple sample: -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "query": { - "match": { "message": "elasticsearch" } - }, - "script_score" : { - "script" : { - "source": "Math.log(2 + doc['likes'].value)" - } - } + "query": { + "function_score": { + "query": { + "match": { "message": "elasticsearch" } + }, + "script_score": { + "script": { + "source": "Math.log(2 + doc['likes'].value)" } + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -175,22 +175,22 @@ same script, and provide parameters to it: -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "query": { - "match": { "message": "elasticsearch" } - }, - "script_score" : { - "script" : { - "params": { - "a": 5, - "b": 1.2 - }, - "source": "params.a / Math.pow(params.b, doc['likes'].value)" - } - } + "query": { + "function_score": { + "query": { + "match": { "message": "elasticsearch" } + }, + "script_score": { + "script": { + "params": { + "a": 5, + "b": 1.2 + }, + "source": "params.a / Math.pow(params.b, doc['likes'].value)" } + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -241,14 +241,14 @@ a lot of memory. -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "random_score": { - "seed": 10, - "field": "_seq_no" - } - } + "query": { + "function_score": { + "random_score": { + "seed": 10, + "field": "_seq_no" + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -269,16 +269,16 @@ doing so would look like: -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "field_value_factor": { - "field": "likes", - "factor": 1.2, - "modifier": "sqrt", - "missing": 1 - } - } + "query": { + "function_score": { + "field_value_factor": { + "field": "likes", + "factor": 1.2, + "modifier": "sqrt", + "missing": 1 + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -380,18 +380,18 @@ days, weeks, and so on. Example: -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "gauss": { - "date": { - "origin": "2013-09-17", <1> - "scale": "10d", - "offset": "5d", <2> - "decay" : 0.5 <2> - } - } + "query": { + "function_score": { + "gauss": { + "date": { + "origin": "2013-09-17", <1> + "scale": "10d", + "offset": "5d", <2> + "decay": 0.5 <2> } + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -578,34 +578,34 @@ the request would look like this: -------------------------------------------------- GET /_search { - "query": { - "function_score": { - "functions": [ - { - "gauss": { - "price": { - "origin": "0", - "scale": "20" - } - } - }, - { - "gauss": { - "location": { - "origin": "11, 12", - "scale": "2km" - } - } + "query": { + "function_score": { + "functions": [ + { + "gauss": { + "price": { + "origin": "0", + "scale": "20" } - ], - "query": { - "match": { - "properties": "balcony" + } + }, + { + "gauss": { + "location": { + "origin": "11, 12", + "scale": "2km" } - }, - "score_mode": "multiply" + } } + ], + "query": { + "match": { + "properties": "balcony" + } + }, + "score_mode": "multiply" } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/fuzzy-query.asciidoc b/docs/reference/query-dsl/fuzzy-query.asciidoc index 3a6d4bf7866..8616459758c 100644 --- a/docs/reference/query-dsl/fuzzy-query.asciidoc +++ b/docs/reference/query-dsl/fuzzy-query.asciidoc @@ -29,13 +29,13 @@ The query then returns exact matches for each expansion. ---- GET /_search { - "query": { - "fuzzy": { - "user": { - "value": "ki" - } - } + "query": { + "fuzzy": { + "user": { + "value": "ki" + } } + } } ---- @@ -46,18 +46,18 @@ GET /_search ---- GET /_search { - "query": { - "fuzzy": { - "user": { - "value": "ki", - "fuzziness": "AUTO", - "max_expansions": 50, - "prefix_length": 0, - "transpositions": true, - "rewrite": "constant_score" - } - } + "query": { + "fuzzy": { + "user": { + "value": "ki", + "fuzziness": "AUTO", + "max_expansions": 50, + "prefix_length": 0, + "transpositions": true, + "rewrite": "constant_score" + } } + } } ---- diff --git a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc index 27f37423fa2..c7784268f9b 100644 --- a/docs/reference/query-dsl/geo-bounding-box-query.asciidoc +++ b/docs/reference/query-dsl/geo-bounding-box-query.asciidoc @@ -11,27 +11,27 @@ bounding box. Assuming the following indexed document: -------------------------------------------------- PUT /my_locations { - "mappings": { + "mappings": { + "properties": { + "pin": { "properties": { - "pin": { - "properties": { - "location": { - "type": "geo_point" - } - } - } + "location": { + "type": "geo_point" + } } + } } + } } PUT /my_locations/_doc/1 { - "pin" : { - "location" : { - "lat" : 40.12, - "lon" : -71.34 - } + "pin": { + "location": { + "lat": 40.12, + "lon": -71.34 } + } } -------------------------------------------------- // TESTSETUP @@ -43,27 +43,27 @@ Then the following simple query can be executed with a -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top_left": { + "lat": 40.73, + "lon": -74.1 }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : { - "lat" : 40.73, - "lon" : -74.1 - }, - "bottom_right" : { - "lat" : 40.01, - "lon" : -71.12 - } - } - } + "bottom_right": { + "lat": 40.01, + "lon": -71.12 } + } } + } } + } } -------------------------------------------------- @@ -98,27 +98,27 @@ representations of the geo point, the filter can accept it as well: -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top_left": { + "lat": 40.73, + "lon": -74.1 }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : { - "lat" : 40.73, - "lon" : -74.1 - }, - "bottom_right" : { - "lat" : 40.01, - "lon" : -71.12 - } - } - } + "bottom_right": { + "lat": 40.01, + "lon": -71.12 } + } } + } } + } } -------------------------------------------------- @@ -132,21 +132,21 @@ conform with http://geojson.org/[GeoJSON]. -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : [-74.1, 40.73], - "bottom_right" : [-71.12, 40.01] - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top_left": [ -74.1, 40.73 ], + "bottom_right": [ -71.12, 40.01 ] + } } + } } + } } -------------------------------------------------- @@ -159,21 +159,21 @@ Format in `lat,lon`. -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : "40.73, -74.1", - "bottom_right" : "40.01, -71.12" - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top_left": "40.73, -74.1", + "bottom_right": "40.01, -71.12" + } + } + } } -} + } } -------------------------------------------------- @@ -184,20 +184,20 @@ GET my_locations/_search -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "wkt" : "BBOX (-74.1, -71.12, 40.73, 40.01)" - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "wkt": "BBOX (-74.1, -71.12, 40.73, 40.01)" + } } + } } + } } -------------------------------------------------- @@ -208,21 +208,21 @@ GET my_locations/_search -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : "dr5r9ydj2y73", - "bottom_right" : "drj7teegpus6" - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top_left": "dr5r9ydj2y73", + "bottom_right": "drj7teegpus6" + } } + } } + } } -------------------------------------------------- @@ -242,14 +242,14 @@ geohash the geohash can be specified in both `top_left` and -------------------------------------------------- GET my_locations/_search { - "query": { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : "dr", - "bottom_right" : "dr" - } - } + "query": { + "geo_bounding_box": { + "pin.location": { + "top_left": "dr", + "bottom_right": "dr" + } } + } } -------------------------------------------------- @@ -271,23 +271,23 @@ values separately. -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top" : 40.73, - "left" : -74.1, - "bottom" : 40.01, - "right" : -71.12 - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top": 40.73, + "left": -74.1, + "bottom": 40.01, + "right": -71.12 + } } + } } + } } -------------------------------------------------- @@ -320,28 +320,28 @@ are not supported. Here is an example: -------------------------------------------------- GET my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_bounding_box": { + "pin.location": { + "top_left": { + "lat": 40.73, + "lon": -74.1 }, - "filter" : { - "geo_bounding_box" : { - "pin.location" : { - "top_left" : { - "lat" : 40.73, - "lon" : -74.1 - }, - "bottom_right" : { - "lat" : 40.10, - "lon" : -71.12 - } - }, - "type" : "indexed" - } + "bottom_right": { + "lat": 40.10, + "lon": -71.12 } + }, + "type": "indexed" } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/geo-distance-query.asciidoc b/docs/reference/query-dsl/geo-distance-query.asciidoc index 576334da131..9544862d545 100644 --- a/docs/reference/query-dsl/geo-distance-query.asciidoc +++ b/docs/reference/query-dsl/geo-distance-query.asciidoc @@ -12,27 +12,27 @@ document: -------------------------------------------------- PUT /my_locations { - "mappings": { + "mappings": { + "properties": { + "pin": { "properties": { - "pin": { - "properties": { - "location": { - "type": "geo_point" - } - } - } + "location": { + "type": "geo_point" + } } + } } + } } PUT /my_locations/_doc/1 { - "pin" : { - "location" : { - "lat" : 40.12, - "lon" : -71.34 - } + "pin": { + "location": { + "lat": 40.12, + "lon": -71.34 } + } } -------------------------------------------------- // TESTSETUP @@ -45,22 +45,22 @@ filter: -------------------------------------------------- GET /my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_distance" : { - "distance" : "200km", - "pin.location" : { - "lat" : 40, - "lon" : -70 - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_distance": { + "distance": "200km", + "pin.location": { + "lat": 40, + "lon": -70 + } } + } } + } } -------------------------------------------------- @@ -77,22 +77,22 @@ representations of the geo point, the filter can accept it as well: -------------------------------------------------- GET /my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_distance" : { - "distance" : "12km", - "pin.location" : { - "lat" : 40, - "lon" : -70 - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_distance": { + "distance": "12km", + "pin.location": { + "lat": 40, + "lon": -70 + } } + } } + } } -------------------------------------------------- @@ -106,19 +106,19 @@ conform with http://geojson.org/[GeoJSON]. -------------------------------------------------- GET /my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_distance" : { - "distance" : "12km", - "pin.location" : [-70, 40] - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_distance": { + "distance": "12km", + "pin.location": [ -70, 40 ] } + } } + } } -------------------------------------------------- @@ -132,19 +132,19 @@ Format in `lat,lon`. -------------------------------------------------- GET /my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_distance" : { - "distance" : "12km", - "pin.location" : "40,-70" - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_distance": { + "distance": "12km", + "pin.location": "40,-70" } + } } + } } -------------------------------------------------- @@ -155,19 +155,19 @@ GET /my_locations/_search -------------------------------------------------- GET /my_locations/_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_distance" : { - "distance" : "12km", - "pin.location" : "drm3btev3e86" - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_distance": { + "distance": "12km", + "pin.location": "drm3btev3e86" } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/geo-polygon-query.asciidoc b/docs/reference/query-dsl/geo-polygon-query.asciidoc index c85462ece18..7767e8f1ee5 100644 --- a/docs/reference/query-dsl/geo-polygon-query.asciidoc +++ b/docs/reference/query-dsl/geo-polygon-query.asciidoc @@ -11,24 +11,24 @@ points. Here is an example: -------------------------------------------------- GET /_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_polygon" : { - "person.location" : { - "points" : [ - {"lat" : 40, "lon" : -70}, - {"lat" : 30, "lon" : -80}, - {"lat" : 20, "lon" : -90} - ] - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_polygon": { + "person.location": { + "points": [ + { "lat": 40, "lon": -70 }, + { "lat": 30, "lon": -80 }, + { "lat": 20, "lon": -90 } + ] + } } + } } + } } -------------------------------------------------- @@ -60,24 +60,24 @@ conform with http://geojson.org/[GeoJSON]. -------------------------------------------------- GET /_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_polygon" : { - "person.location" : { - "points" : [ - [-70, 40], - [-80, 30], - [-90, 20] - ] - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_polygon": { + "person.location": { + "points": [ + [ -70, 40 ], + [ -80, 30 ], + [ -90, 20 ] + ] + } } + } } + } } -------------------------------------------------- @@ -90,24 +90,24 @@ Format in `lat,lon`. -------------------------------------------------- GET /_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_polygon" : { - "person.location" : { - "points" : [ - "40, -70", - "30, -80", - "20, -90" - ] - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_polygon": { + "person.location": { + "points": [ + "40, -70", + "30, -80", + "20, -90" + ] + } } + } } + } } -------------------------------------------------- @@ -118,24 +118,24 @@ GET /_search -------------------------------------------------- GET /_search { - "query": { - "bool" : { - "must" : { - "match_all" : {} - }, - "filter" : { - "geo_polygon" : { - "person.location" : { - "points" : [ - "drn5x1g8cu2y", - "30, -80", - "20, -90" - ] - } - } - } + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_polygon": { + "person.location": { + "points": [ + "drn5x1g8cu2y", + "30, -80", + "20, -90" + ] + } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/geo-shape-query.asciidoc b/docs/reference/query-dsl/geo-shape-query.asciidoc index 6ef87f71f0d..6093a4d0da8 100644 --- a/docs/reference/query-dsl/geo-shape-query.asciidoc +++ b/docs/reference/query-dsl/geo-shape-query.asciidoc @@ -31,22 +31,22 @@ Given the following index with locations as `geo_shape` fields: -------------------------------------------------- PUT /example { - "mappings": { - "properties": { - "location": { - "type": "geo_shape" - } - } + "mappings": { + "properties": { + "location": { + "type": "geo_shape" + } } + } } POST /example/_doc?refresh { - "name": "Wind & Wetter, Berlin, Germany", - "location": { - "type": "point", - "coordinates": [13.400544, 52.530286] - } + "name": "Wind & Wetter, Berlin, Germany", + "location": { + "type": "point", + "coordinates": [ 13.400544, 52.530286 ] + } } -------------------------------------------------- // TESTSETUP @@ -59,24 +59,24 @@ extension: -------------------------------------------------- GET /example/_search { - "query":{ - "bool": { - "must": { - "match_all": {} + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_shape": { + "location": { + "shape": { + "type": "envelope", + "coordinates": [ [ 13.0, 53.0 ], [ 14.0, 52.0 ] ] }, - "filter": { - "geo_shape": { - "location": { - "shape": { - "type": "envelope", - "coordinates" : [[13.0, 53.0], [14.0, 52.0]] - }, - "relation": "within" - } - } - } + "relation": "within" + } } + } } + } } -------------------------------------------------- @@ -87,19 +87,19 @@ The above query can, similarly, be queried on `geo_point` fields. -------------------------------------------------- PUT /example_points { - "mappings": { - "properties": { - "location": { - "type": "geo_point" - } - } + "mappings": { + "properties": { + "location": { + "type": "geo_point" + } } + } } PUT /example_points/_doc/1?refresh { - "name": "Wind & Wetter, Berlin, Germany", - "location": [13.400544, 52.530286] + "name": "Wind & Wetter, Berlin, Germany", + "location": [13.400544, 52.530286] } -------------------------------------------------- // TEST[continued] @@ -112,24 +112,24 @@ returned. -------------------------------------------------- GET /example_points/_search { - "query":{ - "bool": { - "must": { - "match_all": {} + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "geo_shape": { + "location": { + "shape": { + "type": "envelope", + "coordinates": [ [ 13.0, 53.0 ], [ 14.0, 52.0 ] ] }, - "filter": { - "geo_shape": { - "location": { - "shape": { - "type": "envelope", - "coordinates" : [[13.0, 53.0], [14.0, 52.0]] - }, - "relation": "intersects" - } - } - } + "relation": "intersects" + } } + } } + } } -------------------------------------------------- // TEST[continued] @@ -191,40 +191,40 @@ shape: -------------------------------------------------- PUT /shapes { - "mappings": { - "properties": { - "location": { - "type": "geo_shape" - } - } + "mappings": { + "properties": { + "location": { + "type": "geo_shape" + } } + } } PUT /shapes/_doc/deu { - "location": { - "type": "envelope", - "coordinates" : [[13.0, 53.0], [14.0, 52.0]] - } + "location": { + "type": "envelope", + "coordinates" : [[13.0, 53.0], [14.0, 52.0]] + } } GET /example/_search { - "query": { - "bool": { - "filter": { - "geo_shape": { - "location": { - "indexed_shape": { - "index": "shapes", - "id": "deu", - "path": "location" - } - } - } + "query": { + "bool": { + "filter": { + "geo_shape": { + "location": { + "indexed_shape": { + "index": "shapes", + "id": "deu", + "path": "location" } + } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/has-child-query.asciidoc b/docs/reference/query-dsl/has-child-query.asciidoc index 32a27ed2395..3cc0f3c43a4 100644 --- a/docs/reference/query-dsl/has-child-query.asciidoc +++ b/docs/reference/query-dsl/has-child-query.asciidoc @@ -31,16 +31,16 @@ field mapping. For example: ---- PUT /my_index { - "mappings": { - "properties" : { - "my-join-field" : { - "type" : "join", - "relations": { - "parent": "child" - } - } + "mappings": { + "properties": { + "my-join-field": { + "type": "join", + "relations": { + "parent": "child" } + } } + } } ---- @@ -53,17 +53,17 @@ PUT /my_index ---- GET /_search { - "query": { - "has_child" : { - "type" : "child", - "query" : { - "match_all" : {} - }, - "max_children": 10, - "min_children": 2, - "score_mode" : "min" - } + "query": { + "has_child": { + "type": "child", + "query": { + "match_all": {} + }, + "max_children": 10, + "min_children": 2, + "score_mode": "min" } + } } ---- @@ -141,18 +141,18 @@ sorts returned documents by the `click_count` field of their child documents. ---- GET /_search { - "query": { - "has_child" : { - "type" : "child", - "query" : { - "function_score" : { - "script_score": { - "script": "_score * doc['click_count'].value" - } - } - }, - "score_mode" : "max" + "query": { + "has_child": { + "type": "child", + "query": { + "function_score": { + "script_score": { + "script": "_score * doc['click_count'].value" + } } + }, + "score_mode": "max" } + } } ---- diff --git a/docs/reference/query-dsl/has-parent-query.asciidoc b/docs/reference/query-dsl/has-parent-query.asciidoc index e2b8ee0f644..1baae4c76cf 100644 --- a/docs/reference/query-dsl/has-parent-query.asciidoc +++ b/docs/reference/query-dsl/has-parent-query.asciidoc @@ -27,19 +27,19 @@ field mapping. For example: ---- PUT /my-index { - "mappings": { - "properties" : { - "my-join-field" : { - "type" : "join", - "relations": { - "parent": "child" - } - }, - "tag" : { - "type" : "keyword" - } + "mappings": { + "properties": { + "my-join-field": { + "type": "join", + "relations": { + "parent": "child" } + }, + "tag": { + "type": "keyword" + } } + } } ---- @@ -52,18 +52,18 @@ PUT /my-index ---- GET /my-index/_search { - "query": { - "has_parent" : { - "parent_type" : "parent", - "query" : { - "term" : { - "tag" : { - "value" : "Elasticsearch" - } - } - } + "query": { + "has_parent": { + "parent_type": "parent", + "query": { + "term": { + "tag": { + "value": "Elasticsearch" + } } + } } + } } ---- @@ -122,18 +122,18 @@ sorts returned documents by the `view_count` field of their parent documents. ---- GET /_search { - "query": { - "has_parent" : { - "parent_type" : "parent", - "score" : true, - "query" : { - "function_score" : { - "script_score": { - "script": "_score * doc['view_count'].value" - } - } - } + "query": { + "has_parent": { + "parent_type": "parent", + "score": true, + "query": { + "function_score": { + "script_score": { + "script": "_score * doc['view_count'].value" + } } + } } + } } ---- diff --git a/docs/reference/query-dsl/ids-query.asciidoc b/docs/reference/query-dsl/ids-query.asciidoc index d94d0cfc03a..cf7ad4d8c10 100644 --- a/docs/reference/query-dsl/ids-query.asciidoc +++ b/docs/reference/query-dsl/ids-query.asciidoc @@ -13,11 +13,11 @@ the <> field. -------------------------------------------------- GET /_search { - "query": { - "ids" : { - "values" : ["1", "4", "100"] - } + "query": { + "ids" : { + "values" : ["1", "4", "100"] } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/match-all-query.asciidoc b/docs/reference/query-dsl/match-all-query.asciidoc index 8e91c8b74f3..4c8ea5d3e8e 100644 --- a/docs/reference/query-dsl/match-all-query.asciidoc +++ b/docs/reference/query-dsl/match-all-query.asciidoc @@ -23,9 +23,9 @@ The `_score` can be changed with the `boost` parameter: -------------------------------------------------- GET /_search { - "query": { - "match_all": { "boost" : 1.2 } - } + "query": { + "match_all": { "boost" : 1.2 } + } } -------------------------------------------------- @@ -39,8 +39,8 @@ This is the inverse of the `match_all` query, which matches no documents. -------------------------------------------------- GET /_search { - "query": { - "match_none": {} - } + "query": { + "match_none": {} + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/match-bool-prefix-query.asciidoc b/docs/reference/query-dsl/match-bool-prefix-query.asciidoc index ffdacf130be..6d59e9a6df2 100644 --- a/docs/reference/query-dsl/match-bool-prefix-query.asciidoc +++ b/docs/reference/query-dsl/match-bool-prefix-query.asciidoc @@ -13,11 +13,11 @@ is used in a `term` query. The last term is used in a `prefix` query. A -------------------------------------------------- GET /_search { - "query": { - "match_bool_prefix" : { - "message" : "quick brown f" - } + "query": { + "match_bool_prefix" : { + "message" : "quick brown f" } + } } -------------------------------------------------- @@ -28,15 +28,15 @@ following `bool` query -------------------------------------------------- GET /_search { - "query": { - "bool" : { - "should": [ - { "term": { "message": "quick" }}, - { "term": { "message": "brown" }}, - { "prefix": { "message": "f"}} - ] - } + "query": { + "bool" : { + "should": [ + { "term": { "message": "quick" }}, + { "term": { "message": "brown" }}, + { "prefix": { "message": "f"}} + ] } + } } -------------------------------------------------- @@ -59,14 +59,14 @@ configured with the `analyzer` parameter -------------------------------------------------- GET /_search { - "query": { - "match_bool_prefix" : { - "message": { - "query": "quick brown f", - "analyzer": "keyword" - } - } + "query": { + "match_bool_prefix": { + "message": { + "query": "quick brown f", + "analyzer": "keyword" + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/match-phrase-prefix-query.asciidoc b/docs/reference/query-dsl/match-phrase-prefix-query.asciidoc index 031dcaa5874..04b757ba901 100644 --- a/docs/reference/query-dsl/match-phrase-prefix-query.asciidoc +++ b/docs/reference/query-dsl/match-phrase-prefix-query.asciidoc @@ -22,13 +22,13 @@ brown ferrets` but not `the fox is quick and brown`. -------------------------------------------------- GET /_search { - "query": { - "match_phrase_prefix" : { - "message" : { - "query" : "quick brown f" - } - } + "query": { + "match_phrase_prefix": { + "message": { + "query": "quick brown f" + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/match-phrase-query.asciidoc b/docs/reference/query-dsl/match-phrase-query.asciidoc index 0baf3ebbe19..f6b0fa19001 100644 --- a/docs/reference/query-dsl/match-phrase-query.asciidoc +++ b/docs/reference/query-dsl/match-phrase-query.asciidoc @@ -11,11 +11,11 @@ out of the analyzed text. For example: -------------------------------------------------- GET /_search { - "query": { - "match_phrase" : { - "message" : "this is a test" - } + "query": { + "match_phrase": { + "message": "this is a test" } + } } -------------------------------------------------- @@ -30,14 +30,14 @@ definition, or the default search analyzer, for example: -------------------------------------------------- GET /_search { - "query": { - "match_phrase" : { - "message" : { - "query" : "this is a test", - "analyzer" : "my_analyzer" - } - } + "query": { + "match_phrase": { + "message": { + "query": "this is a test", + "analyzer": "my_analyzer" + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/match-query.asciidoc b/docs/reference/query-dsl/match-query.asciidoc index 5c58250248f..4dc7eb0431a 100644 --- a/docs/reference/query-dsl/match-query.asciidoc +++ b/docs/reference/query-dsl/match-query.asciidoc @@ -18,13 +18,13 @@ including options for fuzzy matching. -------------------------------------------------- GET /_search { - "query": { - "match" : { - "message" : { - "query" : "this is a test" - } - } + "query": { + "match": { + "message": { + "query": "this is a test" + } } + } } -------------------------------------------------- @@ -150,11 +150,11 @@ parameters. For example: ---- GET /_search { - "query": { - "match" : { - "message" : "this is a test" - } + "query": { + "match": { + "message": "this is a test" } + } } ---- @@ -175,14 +175,14 @@ Here is an example with the `operator` parameter: -------------------------------------------------- GET /_search { - "query": { - "match" : { - "message" : { - "query" : "this is a test", - "operator" : "and" - } - } + "query": { + "match": { + "message": { + "query": "this is a test", + "operator": "and" + } } + } } -------------------------------------------------- @@ -219,14 +219,14 @@ which does not support fuzzy expansion. -------------------------------------------------- GET /_search { - "query": { - "match" : { - "message" : { - "query" : "this is a testt", - "fuzziness": "AUTO" - } - } + "query": { + "match": { + "message": { + "query": "this is a testt", + "fuzziness": "AUTO" + } } + } } -------------------------------------------------- @@ -241,15 +241,15 @@ change that the `zero_terms_query` option can be used, which accepts -------------------------------------------------- GET /_search { - "query": { - "match" : { - "message" : { - "query" : "to be or not to be", - "operator" : "and", - "zero_terms_query": "all" - } - } + "query": { + "match": { + "message": { + "query": "to be or not to be", + "operator": "and", + "zero_terms_query": "all" + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/mlt-query.asciidoc b/docs/reference/query-dsl/mlt-query.asciidoc index 1a440e418db..65f95cda6ac 100644 --- a/docs/reference/query-dsl/mlt-query.asciidoc +++ b/docs/reference/query-dsl/mlt-query.asciidoc @@ -19,14 +19,14 @@ fields, limiting the number of selected terms to 12. -------------------------------------------------- GET /_search { - "query": { - "more_like_this" : { - "fields" : ["title", "description"], - "like" : "Once upon a time", - "min_term_freq" : 1, - "max_query_terms" : 12 - } + "query": { + "more_like_this" : { + "fields" : ["title", "description"], + "like" : "Once upon a time", + "min_term_freq" : 1, + "max_query_terms" : 12 } + } } -------------------------------------------------- @@ -38,24 +38,24 @@ similar to the one used in the <>. -------------------------------------------------- GET /_search { - "query": { - "more_like_this" : { - "fields" : ["title", "description"], - "like" : [ - { - "_index" : "imdb", - "_id" : "1" - }, - { - "_index" : "imdb", - "_id" : "2" - }, - "and potentially some more text here as well" - ], - "min_term_freq" : 1, - "max_query_terms" : 12 - } + "query": { + "more_like_this": { + "fields": [ "title", "description" ], + "like": [ + { + "_index": "imdb", + "_id": "1" + }, + { + "_index": "imdb", + "_id": "2" + }, + "and potentially some more text here as well" + ], + "min_term_freq": 1, + "max_query_terms": 12 } + } } -------------------------------------------------- @@ -67,29 +67,29 @@ present in the index, the syntax is similar to < - { - "message" : "bonsai tree" - }, - { - "message" : "new tree" - }, - { - "message" : "the office" - }, - { - "message" : "office tree" - } - ] + "query": { + "percolate": { + "field": "query", + "documents": [ <1> + { + "message": "bonsai tree" + }, + { + "message": "new tree" + }, + { + "message": "the office" + }, + { + "message": "office tree" } + ] } + } } -------------------------------------------------- // TEST[continued] @@ -315,14 +315,14 @@ Percolating an existing document, using the index response as basis to build to -------------------------------------------------- GET /my-index/_search { - "query" : { - "percolate" : { - "field": "query", - "index" : "my-index", - "id" : "2", - "version" : 1 <1> - } + "query": { + "percolate": { + "field": "query", + "index": "my-index", + "id": "2", + "version": 1 <1> } + } } -------------------------------------------------- // TEST[continued] @@ -351,11 +351,11 @@ Save a query: -------------------------------------------------- PUT /my-index/_doc/3?refresh { - "query" : { - "match" : { - "message" : "brown fox" - } + "query": { + "match": { + "message": "brown fox" } + } } -------------------------------------------------- // TEST[continued] @@ -366,11 +366,11 @@ Save another query: -------------------------------------------------- PUT /my-index/_doc/4?refresh { - "query" : { - "match" : { - "message" : "lazy dog" - } + "query": { + "match": { + "message": "lazy dog" } + } } -------------------------------------------------- // TEST[continued] @@ -381,19 +381,19 @@ Execute a search request with the `percolate` query and highlighting enabled: -------------------------------------------------- GET /my-index/_search { - "query" : { - "percolate" : { - "field": "query", - "document" : { - "message" : "The quick brown fox jumps over the lazy dog" - } - } - }, - "highlight": { - "fields": { - "message": {} + "query": { + "percolate": { + "field": "query", + "document": { + "message": "The quick brown fox jumps over the lazy dog" } } + }, + "highlight": { + "fields": { + "message": {} + } + } } -------------------------------------------------- // TEST[continued] @@ -477,30 +477,30 @@ When percolating multiple documents at the same time like the request below then -------------------------------------------------- GET /my-index/_search { - "query" : { - "percolate" : { - "field": "query", - "documents" : [ - { - "message" : "bonsai tree" - }, - { - "message" : "new tree" - }, - { - "message" : "the office" - }, - { - "message" : "office tree" - } - ] + "query": { + "percolate": { + "field": "query", + "documents": [ + { + "message": "bonsai tree" + }, + { + "message": "new tree" + }, + { + "message": "the office" + }, + { + "message": "office tree" } - }, - "highlight": { - "fields": { - "message": {} - } + ] } + }, + "highlight": { + "fields": { + "message": {} + } + } } -------------------------------------------------- // TEST[continued] @@ -570,30 +570,30 @@ It is possible to specify multiple `percolate` queries in a single search reques -------------------------------------------------- GET /my-index/_search { - "query" : { - "bool" : { - "should" : [ - { - "percolate" : { - "field" : "query", - "document" : { - "message" : "bonsai tree" - }, - "name": "query1" <1> - } - }, - { - "percolate" : { - "field" : "query", - "document" : { - "message" : "tulip flower" - }, - "name": "query2" <1> - } - } - ] + "query": { + "bool": { + "should": [ + { + "percolate": { + "field": "query", + "document": { + "message": "bonsai tree" + }, + "name": "query1" <1> + } + }, + { + "percolate": { + "field": "query", + "document": { + "message": "tulip flower" + }, + "name": "query2" <1> + } } + ] } + } } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/query-dsl/pinned-query.asciidoc b/docs/reference/query-dsl/pinned-query.asciidoc index 8efdb6e0a54..c55df9ff86f 100644 --- a/docs/reference/query-dsl/pinned-query.asciidoc +++ b/docs/reference/query-dsl/pinned-query.asciidoc @@ -14,17 +14,17 @@ the <> field. -------------------------------------------------- GET /_search { - "query": { - "pinned" : { - "ids" : ["1", "4", "100"], - "organic" : { - "match":{ - "description": "brown shoes" - } - } + "query": { + "pinned": { + "ids": [ "1", "4", "100" ], + "organic": { + "match": { + "description": "iphone" } + } } -} + } +} -------------------------------------------------- [[pinned-query-top-level-parameters]] diff --git a/docs/reference/query-dsl/prefix-query.asciidoc b/docs/reference/query-dsl/prefix-query.asciidoc index 8501f0f7d03..ac44fe74411 100644 --- a/docs/reference/query-dsl/prefix-query.asciidoc +++ b/docs/reference/query-dsl/prefix-query.asciidoc @@ -16,13 +16,13 @@ that begins with `ki`. ---- GET /_search { - "query": { - "prefix": { - "user": { - "value": "ki" - } - } + "query": { + "prefix": { + "user": { + "value": "ki" + } } + } } ---- @@ -53,9 +53,9 @@ You can simplify the `prefix` query syntax by combining the `` and ---- GET /_search { - "query": { - "prefix" : { "user" : "ki" } - } + "query": { + "prefix" : { "user" : "ki" } + } } ---- diff --git a/docs/reference/query-dsl/query-string-query.asciidoc b/docs/reference/query-dsl/query-string-query.asciidoc index f9323dc9058..1c7628c1479 100644 --- a/docs/reference/query-dsl/query-string-query.asciidoc +++ b/docs/reference/query-dsl/query-string-query.asciidoc @@ -42,12 +42,12 @@ whitespace as an operator, `new york city` is passed as-is to the analyzer. -------------------------------------------------- GET /_search { - "query": { - "query_string" : { - "query" : "(new york city) OR (big apple)", - "default_field" : "content" - } + "query": { + "query_string": { + "query": "(new york city) OR (big apple)", + "default_field": "content" } + } } -------------------------------------------------- @@ -265,12 +265,12 @@ For example, the following query -------------------------------------------------- GET /_search { - "query": { - "query_string" : { - "fields" : ["content", "name"], - "query" : "this AND that" - } + "query": { + "query_string": { + "fields": [ "content", "name" ], + "query": "this AND that" } + } } -------------------------------------------------- @@ -281,11 +281,11 @@ matches the same words as -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "query": "(content:this OR name:this) AND (content:that OR name:that)" - } + "query": { + "query_string": { + "query": "(content:this OR name:this) AND (content:that OR name:that)" } + } } -------------------------------------------------- @@ -297,13 +297,13 @@ For example (the `name` is boosted by 5 using `^5` notation): -------------------------------------------------- GET /_search { - "query": { - "query_string" : { - "fields" : ["content", "name^5"], - "query" : "this AND that OR thus", - "tie_breaker" : 0 - } + "query": { + "query_string" : { + "fields" : ["content", "name^5"], + "query" : "this AND that OR thus", + "tie_breaker" : 0 } + } } -------------------------------------------------- @@ -316,12 +316,12 @@ search on all "city" fields: -------------------------------------------------- GET /_search { - "query": { - "query_string" : { - "fields" : ["city.*"], - "query" : "this AND that OR thus" - } + "query": { + "query_string" : { + "fields" : ["city.*"], + "query" : "this AND that OR thus" } + } } -------------------------------------------------- @@ -333,11 +333,11 @@ string itself (properly escaping the `*` sign), for example: -------------------------------------------------- GET /_search { - "query": { - "query_string" : { - "query" : "city.\\*:(this AND that OR thus)" - } + "query": { + "query_string" : { + "query" : "city.\\*:(this AND that OR thus)" } + } } -------------------------------------------------- @@ -352,12 +352,12 @@ introduced fields included). For example: -------------------------------------------------- GET /_search { - "query": { - "query_string" : { - "fields" : ["content", "name.*^5"], - "query" : "this AND that OR thus" - } + "query": { + "query_string" : { + "fields" : ["content", "name.*^5"], + "query" : "this AND that OR thus" } + } } -------------------------------------------------- @@ -446,15 +446,15 @@ many "should" clauses in the resulting query should match. -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "fields": [ - "title" - ], - "query": "this that thus", - "minimum_should_match": 2 - } + "query": { + "query_string": { + "fields": [ + "title" + ], + "query": "this that thus", + "minimum_should_match": 2 } + } } -------------------------------------------------- @@ -472,16 +472,16 @@ in the single field `title`. -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "fields": [ - "title", - "content" - ], - "query": "this that thus", - "minimum_should_match": 2 - } + "query": { + "query_string": { + "fields": [ + "title", + "content" + ], + "query": "this that thus", + "minimum_should_match": 2 } + } } -------------------------------------------------- @@ -496,16 +496,16 @@ that matches documents with the disjunction max over the fields `title` and -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "fields": [ - "title", - "content" - ], - "query": "this OR that OR thus", - "minimum_should_match": 2 - } + "query": { + "query_string": { + "fields": [ + "title", + "content" + ], + "query": "this OR that OR thus", + "minimum_should_match": 2 } + } } -------------------------------------------------- @@ -528,17 +528,17 @@ analyzer are grouped together when the input is analyzed. -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "fields": [ - "title", - "content" - ], - "query": "this OR that OR thus", - "type": "cross_fields", - "minimum_should_match": 2 - } + "query": { + "query_string": { + "fields": [ + "title", + "content" + ], + "query": "this OR that OR thus", + "type": "cross_fields", + "minimum_should_match": 2 } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/range-query.asciidoc b/docs/reference/query-dsl/range-query.asciidoc index 9868db5919f..4f19a4cbb56 100644 --- a/docs/reference/query-dsl/range-query.asciidoc +++ b/docs/reference/query-dsl/range-query.asciidoc @@ -16,15 +16,15 @@ between `10` and `20`. ---- GET /_search { - "query": { - "range" : { - "age" : { - "gte" : 10, - "lte" : 20, - "boost" : 2.0 - } - } + "query": { + "range": { + "age": { + "gte": 10, + "lte": 20, + "boost": 2.0 + } } + } } ---- @@ -157,14 +157,14 @@ contains a date between today and yesterday. ---- GET /_search { - "query": { - "range" : { - "timestamp" : { - "gte" : "now-1d/d", - "lt" : "now/d" - } - } + "query": { + "range": { + "timestamp": { + "gte": "now-1d/d", + "lt": "now/d" + } } + } } ---- diff --git a/docs/reference/query-dsl/regexp-query.asciidoc b/docs/reference/query-dsl/regexp-query.asciidoc index 522bc68adf8..df629d204e3 100644 --- a/docs/reference/query-dsl/regexp-query.asciidoc +++ b/docs/reference/query-dsl/regexp-query.asciidoc @@ -23,16 +23,16 @@ terms can include `ky`, `kay`, and `kimchy`. ---- GET /_search { - "query": { - "regexp": { - "user": { - "value": "k.*y", - "flags" : "ALL", - "max_determinized_states": 10000, - "rewrite": "constant_score" - } - } + "query": { + "regexp": { + "user": { + "value": "k.*y", + "flags": "ALL", + "max_determinized_states": 10000, + "rewrite": "constant_score" + } } + } } ---- diff --git a/docs/reference/query-dsl/script-query.asciidoc b/docs/reference/query-dsl/script-query.asciidoc index 183aab7683f..cba078b5fc2 100644 --- a/docs/reference/query-dsl/script-query.asciidoc +++ b/docs/reference/query-dsl/script-query.asciidoc @@ -18,18 +18,18 @@ WARNING: Using scripts can result in slower search speeds. See ---- GET /_search { - "query": { - "bool" : { - "filter" : { - "script" : { - "script" : { - "source": "doc['num1'].value > 1", - "lang": "painless" - } - } - } + "query": { + "bool": { + "filter": { + "script": { + "script": { + "source": "doc['num1'].value > 1", + "lang": "painless" + } } + } } + } } ---- @@ -55,21 +55,21 @@ in the script's `params` parameter. For example: ---- GET /_search { - "query": { - "bool" : { - "filter" : { - "script" : { - "script" : { - "source" : "doc['num1'].value > params.param1", - "lang" : "painless", - "params" : { - "param1" : 5 - } - } - } + "query": { + "bool": { + "filter": { + "script": { + "script": { + "source": "doc['num1'].value > params.param1", + "lang": "painless", + "params": { + "param1": 5 } + } } + } } + } } ---- diff --git a/docs/reference/query-dsl/script-score-query.asciidoc b/docs/reference/query-dsl/script-score-query.asciidoc index d66370b9dbd..971f030e021 100644 --- a/docs/reference/query-dsl/script-score-query.asciidoc +++ b/docs/reference/query-dsl/script-score-query.asciidoc @@ -18,16 +18,16 @@ The following `script_score` query assigns each returned document a score equal -------------------------------------------------- GET /_search { - "query" : { - "script_score" : { - "query" : { - "match": { "message": "elasticsearch" } - }, - "script" : { - "source" : "doc['likes'].value / 10 " - } - } - } + "query": { + "script_score": { + "query": { + "match": { "message": "elasticsearch" } + }, + "script": { + "source": "doc['likes'].value / 10 " + } + } + } } -------------------------------------------------- @@ -345,23 +345,23 @@ Using an <> provides an explanation of how the -------------------------------------------------- GET /twitter/_explain/0 { - "query" : { - "script_score" : { - "query" : { - "match": { "message": "elasticsearch" } - }, - "script" : { - "source" : """ - long likes = doc['likes'].value; - double normalizedLikes = likes / 10; - if (explanation != null) { - explanation.set('normalized likes = likes / 10 = ' + likes + ' / 10 = ' + normalizedLikes); - } - return normalizedLikes; - """ - } - } - } + "query": { + "script_score": { + "query": { + "match": { "message": "elasticsearch" } + }, + "script": { + "source": """ + long likes = doc['likes'].value; + double normalizedLikes = likes / 10; + if (explanation != null) { + explanation.set('normalized likes = likes / 10 = ' + likes + ' / 10 = ' + normalizedLikes); + } + return normalizedLikes; + """ + } + } + } } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/query-dsl/shape-query.asciidoc b/docs/reference/query-dsl/shape-query.asciidoc index 08114a5a72e..d0934e6b38b 100644 --- a/docs/reference/query-dsl/shape-query.asciidoc +++ b/docs/reference/query-dsl/shape-query.asciidoc @@ -28,22 +28,22 @@ Given the following index: -------------------------------------------------- PUT /example { - "mappings": { - "properties": { - "geometry": { - "type": "shape" - } - } + "mappings": { + "properties": { + "geometry": { + "type": "shape" + } } + } } PUT /example/_doc/1?refresh=wait_for { - "name": "Lucky Landing", - "geometry": { - "type": "point", - "coordinates": [1355.400544, 5255.530286] - } + "name": "Lucky Landing", + "geometry": { + "type": "point", + "coordinates": [ 1355.400544, 5255.530286 ] + } } -------------------------------------------------- // TESTSETUP @@ -55,17 +55,17 @@ The following query will find the point using the Elasticsearch's -------------------------------------------------- GET /example/_search { - "query":{ + "query": { + "shape": { + "geometry": { "shape": { - "geometry": { - "shape": { - "type": "envelope", - "coordinates" : [[1355.0, 5355.0], [1400.0, 5200.0]] - }, - "relation": "within" - } - } + "type": "envelope", + "coordinates": [ [ 1355.0, 5355.0 ], [ 1400.0, 5200.0 ] ] + }, + "relation": "within" + } } + } } -------------------------------------------------- @@ -134,36 +134,36 @@ shape: -------------------------------------------------- PUT /shapes { - "mappings": { - "properties": { - "geometry": { - "type": "shape" - } - } + "mappings": { + "properties": { + "geometry": { + "type": "shape" + } } + } } PUT /shapes/_doc/footprint { - "geometry": { - "type": "envelope", - "coordinates" : [[1355.0, 5355.0], [1400.0, 5200.0]] - } + "geometry": { + "type": "envelope", + "coordinates": [ [ 1355.0, 5355.0 ], [ 1400.0, 5200.0 ] ] + } } GET /example/_search { - "query": { - "shape": { - "geometry": { - "indexed_shape": { - "index": "shapes", - "id": "footprint", - "path": "geometry" - } - } + "query": { + "shape": { + "geometry": { + "indexed_shape": { + "index": "shapes", + "id": "footprint", + "path": "geometry" } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/simple-query-string-query.asciidoc b/docs/reference/query-dsl/simple-query-string-query.asciidoc index 6659a9d860e..4da6a79ff8c 100644 --- a/docs/reference/query-dsl/simple-query-string-query.asciidoc +++ b/docs/reference/query-dsl/simple-query-string-query.asciidoc @@ -156,12 +156,12 @@ value. For example: -------------------------------------------------- GET /_search { - "query": { - "simple_query_string" : { - "fields" : ["content"], - "query" : "foo bar -baz" - } + "query": { + "simple_query_string": { + "fields": [ "content" ], + "query": "foo bar -baz" } + } } -------------------------------------------------- @@ -184,12 +184,12 @@ and `PREFIX`. -------------------------------------------------- GET /_search { - "query": { - "simple_query_string" : { - "query" : "foo | bar + baz*", - "flags" : "OR|AND|PREFIX" - } + "query": { + "simple_query_string": { + "query": "foo | bar + baz*", + "flags": "OR|AND|PREFIX" } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-containing-query.asciidoc b/docs/reference/query-dsl/span-containing-query.asciidoc index 86d01a95914..ec1c0bdf0a8 100644 --- a/docs/reference/query-dsl/span-containing-query.asciidoc +++ b/docs/reference/query-dsl/span-containing-query.asciidoc @@ -11,23 +11,23 @@ query maps to Lucene `SpanContainingQuery`. Here is an example: -------------------------------------------------- GET /_search { - "query": { - "span_containing" : { - "little" : { - "span_term" : { "field1" : "foo" } - }, - "big" : { - "span_near" : { - "clauses" : [ - { "span_term" : { "field1" : "bar" } }, - { "span_term" : { "field1" : "baz" } } - ], - "slop" : 5, - "in_order" : true - } - } + "query": { + "span_containing": { + "little": { + "span_term": { "field1": "foo" } + }, + "big": { + "span_near": { + "clauses": [ + { "span_term": { "field1": "bar" } }, + { "span_term": { "field1": "baz" } } + ], + "slop": 5, + "in_order": true } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-first-query.asciidoc b/docs/reference/query-dsl/span-first-query.asciidoc index 6db0f28c81d..152a646ea2f 100644 --- a/docs/reference/query-dsl/span-first-query.asciidoc +++ b/docs/reference/query-dsl/span-first-query.asciidoc @@ -11,15 +11,15 @@ to Lucene `SpanFirstQuery`. Here is an example: -------------------------------------------------- GET /_search { - "query": { - "span_first" : { - "match" : { - "span_term" : { "user" : "kimchy" } - }, - "end" : 3 - } + "query": { + "span_first": { + "match": { + "span_term": { "user": "kimchy" } + }, + "end": 3 } -} + } +} -------------------------------------------------- The `match` clause can be any other span type query. The `end` controls diff --git a/docs/reference/query-dsl/span-multi-term-query.asciidoc b/docs/reference/query-dsl/span-multi-term-query.asciidoc index 5c3fef19dd5..6ae43076233 100644 --- a/docs/reference/query-dsl/span-multi-term-query.asciidoc +++ b/docs/reference/query-dsl/span-multi-term-query.asciidoc @@ -12,13 +12,13 @@ it can be nested. Example: -------------------------------------------------- GET /_search { - "query": { - "span_multi":{ - "match":{ - "prefix" : { "user" : { "value" : "ki" } } - } - } + "query": { + "span_multi": { + "match": { + "prefix": { "user": { "value": "ki" } } + } } + } } -------------------------------------------------- @@ -28,13 +28,13 @@ A boost can also be associated with the query: -------------------------------------------------- GET /_search { - "query": { - "span_multi":{ - "match":{ - "prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } } - } - } + "query": { + "span_multi": { + "match": { + "prefix": { "user": { "value": "ki", "boost": 1.08 } } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-near-query.asciidoc b/docs/reference/query-dsl/span-near-query.asciidoc index 2c1380ac680..0a1aa7082fb 100644 --- a/docs/reference/query-dsl/span-near-query.asciidoc +++ b/docs/reference/query-dsl/span-near-query.asciidoc @@ -13,17 +13,17 @@ matches are required to be in-order. The span near query maps to Lucene -------------------------------------------------- GET /_search { - "query": { - "span_near" : { - "clauses" : [ - { "span_term" : { "field" : "value1" } }, - { "span_term" : { "field" : "value2" } }, - { "span_term" : { "field" : "value3" } } - ], - "slop" : 12, - "in_order" : false - } + "query": { + "span_near": { + "clauses": [ + { "span_term": { "field": "value1" } }, + { "span_term": { "field": "value2" } }, + { "span_term": { "field": "value3" } } + ], + "slop": 12, + "in_order": false } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-not-query.asciidoc b/docs/reference/query-dsl/span-not-query.asciidoc index 17814d8ff1e..99814eba9d8 100644 --- a/docs/reference/query-dsl/span-not-query.asciidoc +++ b/docs/reference/query-dsl/span-not-query.asciidoc @@ -13,23 +13,23 @@ query maps to Lucene `SpanNotQuery`. Here is an example: -------------------------------------------------- GET /_search { - "query": { - "span_not" : { - "include" : { - "span_term" : { "field1" : "hoya" } - }, - "exclude" : { - "span_near" : { - "clauses" : [ - { "span_term" : { "field1" : "la" } }, - { "span_term" : { "field1" : "hoya" } } - ], - "slop" : 0, - "in_order" : true - } - } + "query": { + "span_not": { + "include": { + "span_term": { "field1": "hoya" } + }, + "exclude": { + "span_near": { + "clauses": [ + { "span_term": { "field1": "la" } }, + { "span_term": { "field1": "hoya" } } + ], + "slop": 0, + "in_order": true } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-or-query.asciidoc b/docs/reference/query-dsl/span-or-query.asciidoc index 4203e8393ff..6c0e78ab266 100644 --- a/docs/reference/query-dsl/span-or-query.asciidoc +++ b/docs/reference/query-dsl/span-or-query.asciidoc @@ -11,15 +11,15 @@ Matches the union of its span clauses. The span or query maps to Lucene -------------------------------------------------- GET /_search { - "query": { - "span_or" : { - "clauses" : [ - { "span_term" : { "field" : "value1" } }, - { "span_term" : { "field" : "value2" } }, - { "span_term" : { "field" : "value3" } } - ] - } + "query": { + "span_or" : { + "clauses" : [ + { "span_term" : { "field" : "value1" } }, + { "span_term" : { "field" : "value2" } }, + { "span_term" : { "field" : "value3" } } + ] } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-term-query.asciidoc b/docs/reference/query-dsl/span-term-query.asciidoc index f85f184650c..647e96bad0f 100644 --- a/docs/reference/query-dsl/span-term-query.asciidoc +++ b/docs/reference/query-dsl/span-term-query.asciidoc @@ -11,9 +11,9 @@ Matches spans containing a term. The span term query maps to Lucene -------------------------------------------------- GET /_search { - "query": { - "span_term" : { "user" : "kimchy" } - } + "query": { + "span_term" : { "user" : "kimchy" } + } } -------------------------------------------------- @@ -23,9 +23,9 @@ A boost can also be associated with the query: -------------------------------------------------- GET /_search { - "query": { - "span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } } - } + "query": { + "span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } } + } } -------------------------------------------------- @@ -35,8 +35,8 @@ Or : -------------------------------------------------- GET /_search { - "query": { - "span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } } - } + "query": { + "span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/span-within-query.asciidoc b/docs/reference/query-dsl/span-within-query.asciidoc index bf989db3248..62a12fc7196 100644 --- a/docs/reference/query-dsl/span-within-query.asciidoc +++ b/docs/reference/query-dsl/span-within-query.asciidoc @@ -11,23 +11,23 @@ query maps to Lucene `SpanWithinQuery`. Here is an example: -------------------------------------------------- GET /_search { - "query": { - "span_within" : { - "little" : { - "span_term" : { "field1" : "foo" } - }, - "big" : { - "span_near" : { - "clauses" : [ - { "span_term" : { "field1" : "bar" } }, - { "span_term" : { "field1" : "baz" } } - ], - "slop" : 5, - "in_order" : true - } - } + "query": { + "span_within": { + "little": { + "span_term": { "field1": "foo" } + }, + "big": { + "span_near": { + "clauses": [ + { "span_term": { "field1": "bar" } }, + { "span_term": { "field1": "baz" } } + ], + "slop": 5, + "in_order": true } + } } + } } -------------------------------------------------- diff --git a/docs/reference/query-dsl/term-query.asciidoc b/docs/reference/query-dsl/term-query.asciidoc index c838c83e639..8880b77bb8c 100644 --- a/docs/reference/query-dsl/term-query.asciidoc +++ b/docs/reference/query-dsl/term-query.asciidoc @@ -28,14 +28,14 @@ instead. ---- GET /_search { - "query": { - "term": { - "user": { - "value": "Kimchy", - "boost": 1.0 - } - } + "query": { + "term": { + "user": { + "value": "Kimchy", + "boost": 1.0 + } } + } } ---- @@ -94,11 +94,11 @@ To see the difference in search results, try the following example. ---- PUT my_index { - "mappings" : { - "properties" : { - "full_text" : { "type" : "text" } - } + "mappings": { + "properties": { + "full_text": { "type": "text" } } + } } ---- diff --git a/docs/reference/query-dsl/terms-query.asciidoc b/docs/reference/query-dsl/terms-query.asciidoc index 12e07378f1d..b8742961494 100644 --- a/docs/reference/query-dsl/terms-query.asciidoc +++ b/docs/reference/query-dsl/terms-query.asciidoc @@ -19,12 +19,12 @@ or `elasticsearch`. ---- GET /_search { - "query" : { - "terms" : { - "user" : ["kimchy", "elasticsearch"], - "boost" : 1.0 - } + "query": { + "terms": { + "user": [ "kimchy", "elasticsearch" ], + "boost": 1.0 } + } } ---- @@ -127,11 +127,11 @@ To see how terms lookup works, try the following example. ---- PUT my_index { - "mappings" : { - "properties" : { - "color" : { "type" : "keyword" } - } + "mappings": { + "properties": { + "color": { "type": "keyword" } } + } } ---- -- diff --git a/docs/reference/query-dsl/terms-set-query.asciidoc b/docs/reference/query-dsl/terms-set-query.asciidoc index 5450eba86c9..2abfe54d539 100644 --- a/docs/reference/query-dsl/terms-set-query.asciidoc +++ b/docs/reference/query-dsl/terms-set-query.asciidoc @@ -49,19 +49,19 @@ the number of matching terms required to return a document. ---- PUT /job-candidates { - "mappings": { - "properties": { - "name": { - "type": "keyword" - }, - "programming_languages": { - "type": "keyword" - }, - "required_matches": { - "type": "long" - } - } + "mappings": { + "properties": { + "name": { + "type": "keyword" + }, + "programming_languages": { + "type": "keyword" + }, + "required_matches": { + "type": "long" + } } + } } ---- // TESTSETUP @@ -85,9 +85,9 @@ search. ---- PUT /job-candidates/_doc/1?refresh { - "name": "Jane Smith", - "programming_languages": ["c++", "java"], - "required_matches": 2 + "name": "Jane Smith", + "programming_languages": [ "c++", "java" ], + "required_matches": 2 } ---- @@ -107,9 +107,9 @@ PUT /job-candidates/_doc/1?refresh ---- PUT /job-candidates/_doc/2?refresh { - "name": "Jason Response", - "programming_languages": ["java", "php"], - "required_matches": 2 + "name": "Jason Response", + "programming_languages": [ "java", "php" ], + "required_matches": 2 } ---- @@ -136,14 +136,14 @@ field. ---- GET /job-candidates/_search { - "query": { - "terms_set": { - "programming_languages": { - "terms": ["c++", "java", "php"], - "minimum_should_match_field": "required_matches" - } - } + "query": { + "terms_set": { + "programming_languages": { + "terms": [ "c++", "java", "php" ], + "minimum_should_match_field": "required_matches" + } } + } } ---- @@ -214,16 +214,16 @@ number of terms provided in the `terms` field. ---- GET /job-candidates/_search { - "query": { - "terms_set": { - "programming_languages": { - "terms": ["c++", "java", "php"], - "minimum_should_match_script": { - "source": "Math.min(params.num_terms, doc['required_matches'].value)" - }, - "boost": 1.0 - } - } + "query": { + "terms_set": { + "programming_languages": { + "terms": [ "c++", "java", "php" ], + "minimum_should_match_script": { + "source": "Math.min(params.num_terms, doc['required_matches'].value)" + }, + "boost": 1.0 + } } + } } ---- diff --git a/docs/reference/query-dsl/wildcard-query.asciidoc b/docs/reference/query-dsl/wildcard-query.asciidoc index 3df6570897d..d1c11031e59 100644 --- a/docs/reference/query-dsl/wildcard-query.asciidoc +++ b/docs/reference/query-dsl/wildcard-query.asciidoc @@ -21,15 +21,15 @@ that begins with `ki` and ends with `y`. These matching terms can include `kiy`, ---- GET /_search { - "query": { - "wildcard": { - "user": { - "value": "ki*y", - "boost": 1.0, - "rewrite": "constant_score" - } - } + "query": { + "wildcard": { + "user": { + "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 02c594a41f6..58191be4de0 100644 --- a/docs/reference/query-dsl/wrapper-query.asciidoc +++ b/docs/reference/query-dsl/wrapper-query.asciidoc @@ -10,11 +10,11 @@ A query that accepts any other query as base64 encoded string. -------------------------------------------------- GET /_search { - "query" : { - "wrapper": { - "query" : "eyJ0ZXJtIiA6IHsgInVzZXIiIDogIktpbWNoeSIgfX0=" <1> - } + "query": { + "wrapper": { + "query": "eyJ0ZXJtIiA6IHsgInVzZXIiIDogIktpbWNoeSIgfX0=" <1> } + } } -------------------------------------------------- diff --git a/docs/reference/rollup/apis/get-job.asciidoc b/docs/reference/rollup/apis/get-job.asciidoc index ef24e0cfa75..4219de26be7 100644 --- a/docs/reference/rollup/apis/get-job.asciidoc +++ b/docs/reference/rollup/apis/get-job.asciidoc @@ -96,65 +96,65 @@ The API yields the following response: [source,console-result] ---- { - "jobs" : [ - { - "config" : { - "id" : "sensor", - "index_pattern" : "sensor-*", - "rollup_index" : "sensor_rollup", - "cron" : "*/30 * * * * ?", - "groups" : { - "date_histogram" : { - "fixed_interval" : "1h", - "delay": "7d", - "field": "timestamp", - "time_zone": "UTC" - }, - "terms" : { - "fields" : [ - "node" - ] - } - }, - "metrics" : [ - { - "field" : "temperature", - "metrics" : [ - "min", - "max", - "sum" - ] - }, - { - "field" : "voltage", - "metrics" : [ - "avg" - ] - } - ], - "timeout" : "20s", - "page_size" : 1000 + "jobs": [ + { + "config": { + "id": "sensor", + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "groups": { + "date_histogram": { + "fixed_interval": "1h", + "delay": "7d", + "field": "timestamp", + "time_zone": "UTC" }, - "status" : { - "job_state" : "stopped", - "upgraded_doc_id": true - }, - "stats" : { - "pages_processed" : 0, - "documents_processed" : 0, - "rollups_indexed" : 0, - "trigger_count" : 0, - "index_failures": 0, - "index_time_in_ms": 0, - "index_total": 0, - "search_failures": 0, - "search_time_in_ms": 0, - "search_total": 0, - "processing_time_in_ms": 0, - "processing_total": 0 + "terms": { + "fields": [ + "node" + ] } - } - ] + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ + "min", + "max", + "sum" + ] + }, + { + "field": "voltage", + "metrics": [ + "avg" + ] + } + ], + "timeout": "20s", + "page_size": 1000 + }, + "status": { + "job_state": "stopped", + "upgraded_doc_id": true + }, + "stats": { + "pages_processed": 0, + "documents_processed": 0, + "rollups_indexed": 0, + "trigger_count": 0, + "index_failures": 0, + "index_time_in_ms": 0, + "index_total": 0, + "search_failures": 0, + "search_time_in_ms": 0, + "search_total": 0, + "processing_time_in_ms": 0, + "processing_total": 0 + } + } + ] } ---- @@ -165,30 +165,30 @@ If we add another job, we can see how multi-job responses are handled: -------------------------------------------------- PUT _rollup/job/sensor2 <1> { - "index_pattern": "sensor-*", - "rollup_index": "sensor_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "1h", - "delay": "7d" - }, - "terms": { - "fields": ["node"] - } + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" }, - "metrics": [ - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "voltage", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node" ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "voltage", + "metrics": [ "avg" ] + } + ] } GET _rollup/job/_all <2> @@ -202,122 +202,122 @@ Which will yield the following response: [source,js] ---- { - "jobs" : [ - { - "config" : { - "id" : "sensor2", - "index_pattern" : "sensor-*", - "rollup_index" : "sensor_rollup", - "cron" : "*/30 * * * * ?", - "groups" : { - "date_histogram" : { - "fixed_interval" : "1h", - "delay": "7d", - "field": "timestamp", - "time_zone": "UTC" - }, - "terms" : { - "fields" : [ - "node" - ] - } - }, - "metrics" : [ - { - "field" : "temperature", - "metrics" : [ - "min", - "max", - "sum" - ] - }, - { - "field" : "voltage", - "metrics" : [ - "avg" - ] - } - ], - "timeout" : "20s", - "page_size" : 1000 + "jobs": [ + { + "config": { + "id": "sensor2", + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "groups": { + "date_histogram": { + "fixed_interval": "1h", + "delay": "7d", + "field": "timestamp", + "time_zone": "UTC" }, - "status" : { - "job_state" : "stopped", - "upgraded_doc_id": true - }, - "stats" : { - "pages_processed" : 0, - "documents_processed" : 0, - "rollups_indexed" : 0, - "trigger_count" : 0, - "index_failures": 0, - "index_time_in_ms": 0, - "index_total": 0, - "search_failures": 0, - "search_time_in_ms": 0, - "search_total": 0, - "processing_time_in_ms": 0, - "processing_total": 0 + "terms": { + "fields": [ + "node" + ] } }, - { - "config" : { - "id" : "sensor", - "index_pattern" : "sensor-*", - "rollup_index" : "sensor_rollup", - "cron" : "*/30 * * * * ?", - "groups" : { - "date_histogram" : { - "fixed_interval" : "1h", - "delay": "7d", - "field": "timestamp", - "time_zone": "UTC" - }, - "terms" : { - "fields" : [ - "node" - ] - } - }, - "metrics" : [ - { - "field" : "temperature", - "metrics" : [ - "min", - "max", - "sum" - ] - }, - { - "field" : "voltage", - "metrics" : [ - "avg" - ] - } - ], - "timeout" : "20s", - "page_size" : 1000 + "metrics": [ + { + "field": "temperature", + "metrics": [ + "min", + "max", + "sum" + ] }, - "status" : { - "job_state" : "stopped", - "upgraded_doc_id": true - }, - "stats" : { - "pages_processed" : 0, - "documents_processed" : 0, - "rollups_indexed" : 0, - "trigger_count" : 0, - "index_failures": 0, - "index_time_in_ms": 0, - "index_total": 0, - "search_failures": 0, - "search_time_in_ms": 0, - "search_total": 0, - "processing_time_in_ms": 0, - "processing_total": 0 + { + "field": "voltage", + "metrics": [ + "avg" + ] } - } - ] + ], + "timeout": "20s", + "page_size": 1000 + }, + "status": { + "job_state": "stopped", + "upgraded_doc_id": true + }, + "stats": { + "pages_processed": 0, + "documents_processed": 0, + "rollups_indexed": 0, + "trigger_count": 0, + "index_failures": 0, + "index_time_in_ms": 0, + "index_total": 0, + "search_failures": 0, + "search_time_in_ms": 0, + "search_total": 0, + "processing_time_in_ms": 0, + "processing_total": 0 + } + }, + { + "config": { + "id": "sensor", + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "groups": { + "date_histogram": { + "fixed_interval": "1h", + "delay": "7d", + "field": "timestamp", + "time_zone": "UTC" + }, + "terms": { + "fields": [ + "node" + ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ + "min", + "max", + "sum" + ] + }, + { + "field": "voltage", + "metrics": [ + "avg" + ] + } + ], + "timeout": "20s", + "page_size": 1000 + }, + "status": { + "job_state": "stopped", + "upgraded_doc_id": true + }, + "stats": { + "pages_processed": 0, + "documents_processed": 0, + "rollups_indexed": 0, + "trigger_count": 0, + "index_failures": 0, + "index_time_in_ms": 0, + "index_total": 0, + "search_failures": 0, + "search_time_in_ms": 0, + "search_total": 0, + "processing_time_in_ms": 0, + "processing_total": 0 + } + } + ] } ---- // NOTCONSOLE diff --git a/docs/reference/rollup/apis/put-job.asciidoc b/docs/reference/rollup/apis/put-job.asciidoc index adcc5daadab..48a71f4ced1 100644 --- a/docs/reference/rollup/apis/put-job.asciidoc +++ b/docs/reference/rollup/apis/put-job.asciidoc @@ -247,30 +247,30 @@ The following example creates a {rollup-job} named `sensor`, targeting the -------------------------------------------------- PUT _rollup/job/sensor { - "index_pattern": "sensor-*", - "rollup_index": "sensor_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { <1> - "date_histogram": { - "field": "timestamp", - "fixed_interval": "1h", - "delay": "7d" - }, - "terms": { - "fields": ["node"] - } + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { <1> + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" }, - "metrics": [ <2> - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "voltage", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node" ] + } + }, + "metrics": [ <2> + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "voltage", + "metrics": [ "avg" ] + } + ] } -------------------------------------------------- // TEST[setup:sensor_index] diff --git a/docs/reference/rollup/apis/rollup-caps.asciidoc b/docs/reference/rollup/apis/rollup-caps.asciidoc index 4d4197a0250..1d0e620a94f 100644 --- a/docs/reference/rollup/apis/rollup-caps.asciidoc +++ b/docs/reference/rollup/apis/rollup-caps.asciidoc @@ -57,30 +57,30 @@ this future scaling: -------------------------------------------------- PUT _rollup/job/sensor { - "index_pattern": "sensor-*", - "rollup_index": "sensor_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "1h", - "delay": "7d" - }, - "terms": { - "fields": ["node"] - } + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" }, - "metrics": [ - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "voltage", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node" ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "voltage", + "metrics": [ "avg" ] + } + ] } -------------------------------------------------- // TEST[setup:sensor_index] diff --git a/docs/reference/rollup/apis/rollup-index-caps.asciidoc b/docs/reference/rollup/apis/rollup-index-caps.asciidoc index a79048f7d36..b8cce32db5d 100644 --- a/docs/reference/rollup/apis/rollup-index-caps.asciidoc +++ b/docs/reference/rollup/apis/rollup-index-caps.asciidoc @@ -53,30 +53,30 @@ Let's create a {rollup-job} that stores its data in `sensor_rollup`: -------------------------------------------------- PUT _rollup/job/sensor { - "index_pattern": "sensor-*", - "rollup_index": "sensor_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "1h", - "delay": "7d" - }, - "terms": { - "fields": ["node"] - } + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" }, - "metrics": [ - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "voltage", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node" ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "voltage", + "metrics": [ "avg" ] + } + ] } -------------------------------------------------- // TEST[setup:sensor_index] diff --git a/docs/reference/rollup/apis/rollup-search.asciidoc b/docs/reference/rollup/apis/rollup-search.asciidoc index ab496a8f111..19bfb125467 100644 --- a/docs/reference/rollup/apis/rollup-search.asciidoc +++ b/docs/reference/rollup/apis/rollup-search.asciidoc @@ -79,30 +79,30 @@ a {rollup-job} with the following configuration: -------------------------------------------------- PUT _rollup/job/sensor { - "index_pattern": "sensor-*", - "rollup_index": "sensor_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "1h", - "delay": "7d" - }, - "terms": { - "fields": ["node"] - } + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" }, - "metrics": [ - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "voltage", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node" ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "voltage", + "metrics": [ "avg" ] + } + ] } -------------------------------------------------- // TEST[setup:sensor_index] @@ -116,14 +116,14 @@ data: -------------------------------------------------- GET /sensor_rollup/_rollup_search { - "size": 0, - "aggregations": { - "max_temperature": { - "max": { - "field": "temperature" - } - } + "size": 0, + "aggregations": { + "max_temperature": { + "max": { + "field": "temperature" + } } + } } -------------------------------------------------- // TEST[setup:sensor_prefab_data] @@ -171,14 +171,14 @@ If we try to execute that search: -------------------------------------------------- GET sensor_rollup/_rollup_search { - "size": 0, - "aggregations": { - "avg_temperature": { - "avg": { - "field": "temperature" - } - } + "size": 0, + "aggregations": { + "avg_temperature": { + "avg": { + "field": "temperature" + } } + } } -------------------------------------------------- // TEST[continued] @@ -187,19 +187,19 @@ GET sensor_rollup/_rollup_search [source,console-result] ---- { - "error" : { - "root_cause" : [ - { - "type" : "illegal_argument_exception", - "reason" : "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", - "stack_trace": ... - } - ], - "type" : "illegal_argument_exception", - "reason" : "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", + "error": { + "root_cause": [ + { + "type": "illegal_argument_exception", + "reason": "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", "stack_trace": ... - }, - "status": 400 + } + ], + "type": "illegal_argument_exception", + "reason": "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", + "stack_trace": ... + }, + "status": 400 } ---- // TESTRESPONSE[s/"stack_trace": \.\.\./"stack_trace": $body.$_path/] @@ -214,14 +214,14 @@ the live indices to the URI: -------------------------------------------------- GET sensor-1,sensor_rollup/_rollup_search <1> { - "size": 0, - "aggregations": { - "max_temperature": { - "max": { - "field": "temperature" - } - } + "size": 0, + "aggregations": { + "max_temperature": { + "max": { + "field": "temperature" + } } + } } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/rollup/rollup-getting-started.asciidoc b/docs/reference/rollup/rollup-getting-started.asciidoc index 740a921713d..7eafd04682b 100644 --- a/docs/reference/rollup/rollup-getting-started.asciidoc +++ b/docs/reference/rollup/rollup-getting-started.asciidoc @@ -35,29 +35,29 @@ one hour or greater. A rollup job might look like this: -------------------------------------------------- PUT _rollup/job/sensor { - "index_pattern": "sensor-*", - "rollup_index": "sensor_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "60m" - }, - "terms": { - "fields": ["node"] - } + "index_pattern": "sensor-*", + "rollup_index": "sensor_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "60m" }, - "metrics": [ - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "voltage", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node" ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "voltage", + "metrics": [ "avg" ] + } + ] } -------------------------------------------------- // TEST[setup:sensor_index] @@ -153,14 +153,14 @@ For example, take this query: -------------------------------------------------- GET /sensor_rollup/_rollup_search { - "size": 0, - "aggregations": { - "max_temperature": { - "max": { - "field": "temperature" - } - } + "size": 0, + "aggregations": { + "max_temperature": { + "max": { + "field": "temperature" + } } + } } -------------------------------------------------- // TEST[setup:sensor_prefab_data] @@ -210,34 +210,34 @@ Finally, we can use those grouping fields we defined to construct a more complic -------------------------------------------------- GET /sensor_rollup/_rollup_search { - "size": 0, - "aggregations": { - "timeline": { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "7d" + "size": 0, + "aggregations": { + "timeline": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "7d" + }, + "aggs": { + "nodes": { + "terms": { + "field": "node" + }, + "aggs": { + "max_temperature": { + "max": { + "field": "temperature" + } }, - "aggs": { - "nodes": { - "terms": { - "field": "node" - }, - "aggs": { - "max_temperature": { - "max": { - "field": "temperature" - } - }, - "avg_voltage": { - "avg": { - "field": "voltage" - } - } - } - } + "avg_voltage": { + "avg": { + "field": "voltage" + } } + } } + } } + } } -------------------------------------------------- // TEST[setup:sensor_prefab_data] diff --git a/docs/reference/rollup/rollup-search-limitations.asciidoc b/docs/reference/rollup/rollup-search-limitations.asciidoc index f6315e12a30..9e5315043ed 100644 --- a/docs/reference/rollup/rollup-search-limitations.asciidoc +++ b/docs/reference/rollup/rollup-search-limitations.asciidoc @@ -45,14 +45,14 @@ the usage of `avg` here is not allowed: -------------------------------------------------- GET sensor_rollup/_rollup_search { - "size": 0, - "aggregations": { - "avg_temperature": { - "avg": { - "field": "temperature" - } - } + "size": 0, + "aggregations": { + "avg_temperature": { + "avg": { + "field": "temperature" + } } + } } -------------------------------------------------- // TEST[setup:sensor_prefab_data] @@ -63,19 +63,19 @@ The response will tell you that the field and aggregation were not possible, bec [source,console-result] ---- { - "error" : { - "root_cause" : [ - { - "type" : "illegal_argument_exception", - "reason" : "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", - "stack_trace": ... - } - ], - "type" : "illegal_argument_exception", - "reason" : "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", + "error": { + "root_cause": [ + { + "type": "illegal_argument_exception", + "reason": "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", "stack_trace": ... - }, - "status": 400 + } + ], + "type": "illegal_argument_exception", + "reason": "There is not a rollup job that has a [avg] agg with name [avg_temperature] which also satisfies all requirements of query.", + "stack_trace": ... + }, + "status": 400 } ---- // TESTRESPONSE[s/"stack_trace": \.\.\./"stack_trace": $body.$_path/] diff --git a/docs/reference/rollup/understanding-groups.asciidoc b/docs/reference/rollup/understanding-groups.asciidoc index 8d0aadb9778..cb5cc501b34 100644 --- a/docs/reference/rollup/understanding-groups.asciidoc +++ b/docs/reference/rollup/understanding-groups.asciidoc @@ -211,30 +211,30 @@ the best practice is to combine them into a single rollup job which covers both -------------------------------------------------- PUT _rollup/job/combined { - "index_pattern": "data-*", - "rollup_index": "data_rollup", - "cron": "*/30 * * * * ?", - "page_size" :1000, - "groups" : { - "date_histogram": { - "field": "timestamp", - "fixed_interval": "1h", - "delay": "7d" - }, - "terms": { - "fields": ["node", "title"] - } + "index_pattern": "data-*", + "rollup_index": "data_rollup", + "cron": "*/30 * * * * ?", + "page_size": 1000, + "groups": { + "date_histogram": { + "field": "timestamp", + "fixed_interval": "1h", + "delay": "7d" }, - "metrics": [ - { - "field": "temperature", - "metrics": ["min", "max", "sum"] - }, - { - "field": "price", - "metrics": ["avg"] - } - ] + "terms": { + "fields": [ "node", "title" ] + } + }, + "metrics": [ + { + "field": "temperature", + "metrics": [ "min", "max", "sum" ] + }, + { + "field": "price", + "metrics": [ "avg" ] + } + ] } -------------------------------------------------- // NOTCONSOLE diff --git a/docs/reference/search.asciidoc b/docs/reference/search.asciidoc index 944ec64bfab..56b1d7d8c93 100644 --- a/docs/reference/search.asciidoc +++ b/docs/reference/search.asciidoc @@ -18,9 +18,9 @@ the user name: -------------------------------------------------- POST /twitter/_doc?routing=kimchy { - "user" : "kimchy", - "post_date" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" + "user" : "kimchy", + "post_date" : "2009-11-15T14:12:12", + "message" : "trying out Elasticsearch" } -------------------------------------------------- @@ -32,18 +32,18 @@ only the relevant shard: -------------------------------------------------- POST /twitter/_search?routing=kimchy { - "query": { - "bool" : { - "must" : { - "query_string" : { - "query" : "some query string here" - } - }, - "filter" : { - "term" : { "user" : "kimchy" } - } + "query": { + "bool": { + "must": { + "query_string": { + "query": "some query string here" } + }, + "filter": { + "term": { "user": "kimchy" } + } } + } } -------------------------------------------------- // TEST[continued] @@ -72,9 +72,9 @@ This can be turned off by changing the dynamic cluster setting -------------------------------------------------- PUT /_cluster/settings { - "transient": { - "cluster.routing.use_adaptive_replica_selection": false - } + "transient": { + "cluster.routing.use_adaptive_replica_selection": false + } } -------------------------------------------------- @@ -96,10 +96,10 @@ the request with two different groups: -------------------------------------------------- POST /_search { - "query" : { - "match_all" : {} - }, - "stats" : ["group1", "group2"] + "query" : { + "match_all" : {} + }, + "stats" : ["group1", "group2"] } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/search/async-search.asciidoc b/docs/reference/search/async-search.asciidoc index 04b5120a8d3..3c788f704bc 100644 --- a/docs/reference/search/async-search.asciidoc +++ b/docs/reference/search/async-search.asciidoc @@ -17,17 +17,17 @@ parameters and request body as the <>. -------------------------------------------------- POST /sales*/_async_search?size=0 { - "sort" : [ - { "date" : {"order" : "asc"} } - ], - "aggs" : { - "sale_date" : { - "date_histogram" : { - "field" : "date", - "calendar_interval": "1d" - } - } + "sort": [ + { "date": { "order": "asc" } } + ], + "aggs": { + "sale_date": { + "date_histogram": { + "field": "date", + "calendar_interval": "1d" + } } + } } -------------------------------------------------- // TEST[setup:sales] diff --git a/docs/reference/search/clear-scroll-api.asciidoc b/docs/reference/search/clear-scroll-api.asciidoc index e09d8a097a4..6e5325d6581 100644 --- a/docs/reference/search/clear-scroll-api.asciidoc +++ b/docs/reference/search/clear-scroll-api.asciidoc @@ -25,7 +25,7 @@ GET /_search?scroll=1m -------------------------------------------------- DELETE /_search/scroll { - "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/search/count.asciidoc b/docs/reference/search/count.asciidoc index 674a3c10bc7..8bec2815ea2 100644 --- a/docs/reference/search/count.asciidoc +++ b/docs/reference/search/count.asciidoc @@ -99,16 +99,16 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=query] -------------------------------------------------- PUT /twitter/_doc/1?refresh { - "user": "kimchy" + "user": "kimchy" } GET /twitter/_count?q=user:kimchy GET /twitter/_count { - "query" : { - "term" : { "user" : "kimchy" } - } + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- @@ -118,13 +118,13 @@ index for a certain user. The API returns the following response: [source,console-result] -------------------------------------------------- { - "count" : 1, - "_shards" : { - "total" : 1, - "successful" : 1, - "skipped" : 0, - "failed" : 0 - } + "count": 1, + "_shards": { + "total": 1, + "successful": 1, + "skipped": 0, + "failed": 0 + } } -------------------------------------------------- diff --git a/docs/reference/search/explain.asciidoc b/docs/reference/search/explain.asciidoc index aeb8b9ba430..8aa490bf098 100644 --- a/docs/reference/search/explain.asciidoc +++ b/docs/reference/search/explain.asciidoc @@ -8,9 +8,9 @@ query. -------------------------------------------------- GET /twitter/_explain/0 { - "query" : { - "match" : { "message" : "elasticsearch" } - } + "query" : { + "match" : { "message" : "elasticsearch" } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -89,9 +89,9 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=query] -------------------------------------------------- GET /twitter/_explain/0 { - "query" : { - "match" : { "message" : "elasticsearch" } - } + "query" : { + "match" : { "message" : "elasticsearch" } + } } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/search/field-caps.asciidoc b/docs/reference/search/field-caps.asciidoc index 1c42a454bd0..610c97f311a 100644 --- a/docs/reference/search/field-caps.asciidoc +++ b/docs/reference/search/field-caps.asciidoc @@ -134,30 +134,30 @@ The API returns the following response: [source,console-result] -------------------------------------------------- { - "indices": ["index1", "index2", "index3", "index4", "index5"], - "fields": { - "rating": { <1> - "long": { - "searchable": true, - "aggregatable": false, - "indices": ["index1", "index2"], - "non_aggregatable_indices": ["index1"] <2> - }, - "keyword": { - "searchable": false, - "aggregatable": true, - "indices": ["index3", "index4"], - "non_searchable_indices": ["index4"] <3> - } - }, - "title": { <4> - "text": { - "searchable": true, - "aggregatable": false + "indices": [ "index1", "index2", "index3", "index4", "index5" ], + "fields": { + "rating": { <1> + "long": { + "searchable": true, + "aggregatable": false, + "indices": [ "index1", "index2" ], + "non_aggregatable_indices": [ "index1" ] <2> + }, + "keyword": { + "searchable": false, + "aggregatable": true, + "indices": [ "index3", "index4" ], + "non_searchable_indices": [ "index4" ] <3> + } + }, + "title": { <4> + "text": { + "searchable": true, + "aggregatable": false - } - } + } } + } } -------------------------------------------------- // TESTRESPONSE[skip:historically skipped] @@ -183,40 +183,40 @@ in some indices but not all: [source,console-result] -------------------------------------------------- { - "indices": ["index1", "index2", "index3"], - "fields": { - "rating": { - "long": { - "searchable": true, - "aggregatable": false, - "indices": ["index1", "index2"], - "non_aggregatable_indices": ["index1"] - }, - "keyword": { - "searchable": false, - "aggregatable": true, - "indices": ["index3", "index4"], - "non_searchable_indices": ["index4"] - }, - "unmapped": { <1> - "indices": ["index5"], - "searchable": false, - "aggregatable": false - } - }, - "title": { - "text": { - "indices": ["index1", "index2", "index3", "index4"], - "searchable": true, - "aggregatable": false - }, - "unmapped": { <2> - "indices": ["index5"] - "searchable": false, - "aggregatable": false - } - } + "indices": [ "index1", "index2", "index3" ], + "fields": { + "rating": { + "long": { + "searchable": true, + "aggregatable": false, + "indices": [ "index1", "index2" ], + "non_aggregatable_indices": [ "index1" ] + }, + "keyword": { + "searchable": false, + "aggregatable": true, + "indices": [ "index3", "index4" ], + "non_searchable_indices": [ "index4" ] + }, + "unmapped": { <1> + "indices": [ "index5" ], + "searchable": false, + "aggregatable": false + } + }, + "title": { + "text": { + "indices": [ "index1", "index2", "index3", "index4" ], + "searchable": true, + "aggregatable": false + }, + "unmapped": { <2> + "indices": [ "index5" ], + "searchable": false, + "aggregatable": false + } } + } } -------------------------------------------------- // TESTRESPONSE[skip:historically skipped] @@ -230,13 +230,13 @@ It is also possible to filter indices with a query: -------------------------------------------------- POST twitter*/_field_caps?fields=rating { - "index_filter": { - "range": { - "@timestamp": { - "gte": "2018" - } - } + "index_filter": { + "range": { + "@timestamp": { + "gte": "2018" + } } + } } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/search/multi-search.asciidoc b/docs/reference/search/multi-search.asciidoc index 763021c281a..d5ca8423dfa 100644 --- a/docs/reference/search/multi-search.asciidoc +++ b/docs/reference/search/multi-search.asciidoc @@ -347,16 +347,16 @@ You can also create search templates: ------------------------------------------ POST /_scripts/my_template_1 { - "script": { - "lang": "mustache", - "source": { - "query": { - "match": { - "message": "{{query_string}}" - } - } + "script": { + "lang": "mustache", + "source": { + "query": { + "match": { + "message": "{{query_string}}" } + } } + } } ------------------------------------------ // TEST[setup:twitter] @@ -366,16 +366,16 @@ POST /_scripts/my_template_1 ------------------------------------------ POST /_scripts/my_template_2 { - "script": { - "lang": "mustache", - "source": { - "query": { - "term": { - "{{field}}": "{{value}}" - } - } + "script": { + "lang": "mustache", + "source": { + "query": { + "term": { + "{{field}}": "{{value}}" } + } } + } } ------------------------------------------ // TEST[continued] diff --git a/docs/reference/search/rank-eval.asciidoc b/docs/reference/search/rank-eval.asciidoc index e29458e68de..b616d5d12a8 100644 --- a/docs/reference/search/rank-eval.asciidoc +++ b/docs/reference/search/rank-eval.asciidoc @@ -97,10 +97,10 @@ In its most basic form, a request to the `_rank_eval` endpoint has two sections: ----------------------------- GET /my_index/_rank_eval { - "requests": [ ... ], <1> - "metric": { <2> - "mean_reciprocal_rank": { ... } <3> - } + "requests": [ ... ], <1> + "metric": { <2> + "mean_reciprocal_rank": { ... } <3> + } } ----------------------------- // NOTCONSOLE @@ -116,29 +116,29 @@ application, along with the document ratings for each particular search request. ----------------------------- GET /my_index/_rank_eval { - "requests": [ - { - "id": "amsterdam_query", <1> - "request": { <2> - "query": { "match": { "text": "amsterdam" }} - }, - "ratings": [ <3> - { "_index": "my_index", "_id": "doc1", "rating": 0 }, - { "_index": "my_index", "_id": "doc2", "rating": 3}, - { "_index": "my_index", "_id": "doc3", "rating": 1 } - ] - }, - { - "id": "berlin_query", - "request": { - "query": { "match": { "text": "berlin" }} - }, - "ratings": [ - { "_index": "my_index", "_id": "doc1", "rating": 1 } - ] - } - ] - } + "requests": [ + { + "id": "amsterdam_query", <1> + "request": { <2> + "query": { "match": { "text": "amsterdam" } } + }, + "ratings": [ <3> + { "_index": "my_index", "_id": "doc1", "rating": 0 }, + { "_index": "my_index", "_id": "doc2", "rating": 3 }, + { "_index": "my_index", "_id": "doc3", "rating": 1 } + ] + }, + { + "id": "berlin_query", + "request": { + "query": { "match": { "text": "berlin" } } + }, + "ratings": [ + { "_index": "my_index", "_id": "doc1", "rating": 1 } + ] + } + ] +} ----------------------------- // NOTCONSOLE @@ -232,19 +232,19 @@ that contains one relevant result in position 1. -------------------------------- GET /twitter/_rank_eval { - "requests": [ + "requests": [ { - "id": "JFK query", - "request": { "query": { "match_all": {}}}, - "ratings": [] - }], - "metric": { - "precision": { - "k" : 20, - "relevant_rating_threshold": 1, - "ignore_unlabeled": false - } - } + "id": "JFK query", + "request": { "query": { "match_all": {} } }, + "ratings": [] + } ], + "metric": { + "precision": { + "k": 20, + "relevant_rating_threshold": 1, + "ignore_unlabeled": false + } + } } -------------------------------- // TEST[setup:twitter] @@ -287,18 +287,18 @@ that contains one relevant result in position 1. -------------------------------- GET /twitter/_rank_eval { - "requests": [ + "requests": [ { - "id": "JFK query", - "request": { "query": { "match_all": {}}}, - "ratings": [] - }], - "metric": { - "recall": { - "k" : 20, - "relevant_rating_threshold": 1 - } - } + "id": "JFK query", + "request": { "query": { "match_all": {} } }, + "ratings": [] + } ], + "metric": { + "recall": { + "k": 20, + "relevant_rating_threshold": 1 + } + } } -------------------------------- // TEST[setup:twitter] @@ -328,18 +328,18 @@ https://en.wikipedia.org/wiki/Mean_reciprocal_rank[mean reciprocal rank]. -------------------------------- GET /twitter/_rank_eval { - "requests": [ + "requests": [ { - "id": "JFK query", - "request": { "query": { "match_all": {}}}, - "ratings": [] - }], - "metric": { - "mean_reciprocal_rank": { - "k" : 20, - "relevant_rating_threshold" : 1 - } + "id": "JFK query", + "request": { "query": { "match_all": {} } }, + "ratings": [] + } ], + "metric": { + "mean_reciprocal_rank": { + "k": 20, + "relevant_rating_threshold": 1 } + } } -------------------------------- // TEST[setup:twitter] @@ -372,18 +372,18 @@ the overall DCG metric. -------------------------------- GET /twitter/_rank_eval { - "requests": [ + "requests": [ { - "id": "JFK query", - "request": { "query": { "match_all": {}}}, - "ratings": [] - }], - "metric": { - "dcg": { - "k" : 20, - "normalize": false - } + "id": "JFK query", + "request": { "query": { "match_all": {} } }, + "ratings": [] + } ], + "metric": { + "dcg": { + "k": 20, + "normalize": false } + } } -------------------------------- // TEST[setup:twitter] @@ -428,18 +428,18 @@ for. -------------------------------- GET /twitter/_rank_eval { - "requests": [ + "requests": [ { - "id": "JFK query", - "request": { "query": { "match_all": {}}}, - "ratings": [] - }], - "metric": { - "expected_reciprocal_rank": { - "maximum_relevance" : 3, - "k" : 20 - } + "id": "JFK query", + "request": { "query": { "match_all": {} } }, + "ratings": [] + } ], + "metric": { + "expected_reciprocal_rank": { + "maximum_relevance": 3, + "k": 20 } + } } -------------------------------- // TEST[setup:twitter] @@ -466,39 +466,39 @@ potential errors of individual queries. The response has the following format: [source,js] -------------------------------- { - "rank_eval": { - "metric_score": 0.4, <1> - "details": { - "my_query_id1": { <2> - "metric_score": 0.6, <3> - "unrated_docs": [ <4> - { - "_index": "my_index", - "_id": "1960795" - }, [...] - ], - "hits": [ - { - "hit": { <5> - "_index": "my_index", - "_type": "page", - "_id": "1528558", - "_score": 7.0556192 - }, - "rating": 1 - }, [...] - ], - "metric_details": { <6> - "precision" : { - "relevant_docs_retrieved": 6, - "docs_retrieved": 10 - } - } + "rank_eval": { + "metric_score": 0.4, <1> + "details": { + "my_query_id1": { <2> + "metric_score": 0.6, <3> + "unrated_docs": [ <4> + { + "_index": "my_index", + "_id": "1960795" + }, ... + ], + "hits": [ + { + "hit": { <5> + "_index": "my_index", + "_type": "page", + "_id": "1528558", + "_score": 7.0556192 }, - "my_query_id2" : { [...] } - }, - "failures": { [...] } - } + "rating": 1 + }, ... + ], + "metric_details": { <6> + "precision": { + "relevant_docs_retrieved": 6, + "docs_retrieved": 10 + } + } + }, + "my_query_id2": { [... ] } + }, + "failures": { [... ] } + } } -------------------------------- // NOTCONSOLE diff --git a/docs/reference/search/request-body.asciidoc b/docs/reference/search/request-body.asciidoc index 3a9ab104cb9..3dd93b21af9 100644 --- a/docs/reference/search/request-body.asciidoc +++ b/docs/reference/search/request-body.asciidoc @@ -7,9 +7,9 @@ Specifies search criteria as request body parameters. -------------------------------------------------- GET /twitter/_search { - "query" : { - "term" : { "user" : "kimchy" } - } + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/search/request/collapse.asciidoc b/docs/reference/search/request/collapse.asciidoc index 7d8466566fa..ce7a9459772 100644 --- a/docs/reference/search/request/collapse.asciidoc +++ b/docs/reference/search/request/collapse.asciidoc @@ -9,16 +9,16 @@ For instance the query below retrieves the best tweet for each user and sorts th -------------------------------------------------- GET /twitter/_search { - "query": { - "match": { - "message": "elasticsearch" - } - }, - "collapse" : { - "field" : "user" <1> - }, - "sort": ["likes"], <2> - "from": 10 <3> + "query": { + "match": { + "message": "elasticsearch" + } + }, + "collapse": { + "field": "user" <1> + }, + "sort": [ "likes" ], <2> + "from": 10 <3> } -------------------------------------------------- // TEST[setup:twitter] @@ -43,21 +43,21 @@ It is also possible to expand each collapsed top hits with the `inner_hits` opti -------------------------------------------------- GET /twitter/_search { - "query": { - "match": { - "message": "elasticsearch" - } + "query": { + "match": { + "message": "elasticsearch" + } + }, + "collapse": { + "field": "user", <1> + "inner_hits": { + "name": "last_tweets", <2> + "size": 5, <3> + "sort": [ { "date": "asc" } ] <4> }, - "collapse" : { - "field" : "user", <1> - "inner_hits": { - "name": "last_tweets", <2> - "size": 5, <3> - "sort": [{ "date": "asc" }] <4> - }, - "max_concurrent_group_searches": 4 <5> - }, - "sort": ["likes"] + "max_concurrent_group_searches": 4 <5> + }, + "sort": [ "likes" ] } -------------------------------------------------- // TEST[setup:twitter] @@ -77,27 +77,27 @@ multiple representations of the collapsed hits. -------------------------------------------------- GET /twitter/_search { - "query": { - "match": { - "message": "elasticsearch" - } - }, - "collapse" : { - "field" : "user", <1> - "inner_hits": [ - { - "name": "most_liked", <2> - "size": 3, - "sort": ["likes"] - }, - { - "name": "most_recent", <3> - "size": 3, - "sort": [{ "date": "asc" }] - } - ] - }, - "sort": ["likes"] + "query": { + "match": { + "message": "elasticsearch" + } + }, + "collapse": { + "field": "user", <1> + "inner_hits": [ + { + "name": "most_liked", <2> + "size": 3, + "sort": [ "likes" ] + }, + { + "name": "most_recent", <3> + "size": 3, + "sort": [ { "date": "asc" } ] + } + ] + }, + "sort": [ "likes" ] } -------------------------------------------------- // TEST[setup:twitter] @@ -128,19 +128,19 @@ for each user. -------------------------------------------------- GET /twitter/_search { - "query": { - "match": { - "message": "elasticsearch" - } - }, - "collapse" : { - "field" : "country", - "inner_hits" : { - "name": "by_location", - "collapse" : {"field" : "user"}, - "size": 3 - } + "query": { + "match": { + "message": "elasticsearch" } + }, + "collapse": { + "field": "country", + "inner_hits": { + "name": "by_location", + "collapse": { "field": "user" }, + "size": 3 + } + } } -------------------------------------------------- // NOTCONSOLE @@ -150,69 +150,69 @@ Response: [source,js] -------------------------------------------------- { + ... + "hits": [ + { + "_index": "twitter", + "_type": "_doc", + "_id": "9", + "_score": ..., + "_source": {...}, + "fields": { "country": [ "UK" ] }, + "inner_hits": { + "by_location": { + "hits": { + ..., + "hits": [ + { + ... + "fields": { "user": [ "user124" ] } + }, + { + ... + "fields": { "user": [ "user589" ] } + }, + { + ... + "fields": { "user": [ "user001" ] } + } + ] + } + } + } + }, + { + "_index": "twitter", + "_type": "_doc", + "_id": "1", + "_score": .., + "_source": {... + }, + "fields": { "country": [ "Canada" ] }, + "inner_hits": { + "by_location": { + "hits": { + ..., + "hits": [ + { + ... + "fields": { "user": [ "user444" ] } + }, + { + ... + "fields": { "user": [ "user1111" ] } + }, + { + ... + "fields": { "user": [ "user999" ] } + } + ] + } + } + } + }, ... - "hits": [ - { - "_index": "twitter", - "_type": "_doc", - "_id": "9", - "_score": ..., - "_source": {...}, - "fields": {"country": ["UK"]}, - "inner_hits":{ - "by_location": { - "hits": { - ..., - "hits": [ - { - ... - "fields": {"user" : ["user124"]} - }, - { - ... - "fields": {"user" : ["user589"]} - }, - { - ... - "fields": {"user" : ["user001"]} - } - ] - } - } - } - }, - { - "_index": "twitter", - "_type": "_doc", - "_id": "1", - "_score": .., - "_source": {...}, - "fields": {"country": ["Canada"]}, - "inner_hits":{ - "by_location": { - "hits": { - ..., - "hits": [ - { - ... - "fields": {"user" : ["user444"]} - }, - { - ... - "fields": {"user" : ["user1111"]} - }, - { - ... - "fields": {"user" : ["user999"]} - } - ] - } - } - } - - }, - .... - ] + ] } -------------------------------------------------- // NOTCONSOLE diff --git a/docs/reference/search/request/highlighters-internal.asciidoc b/docs/reference/search/request/highlighters-internal.asciidoc index cad08c9ece4..494b0f93b7c 100644 --- a/docs/reference/search/request/highlighters-internal.asciidoc +++ b/docs/reference/search/request/highlighters-internal.asciidoc @@ -89,14 +89,14 @@ using `english` analyzer, and will be indexed without offsets or term vectors. -------------------------------------------------- PUT test_index { - "mappings": { - "properties": { - "content" : { - "type" : "text", - "analyzer" : "english" - } - } + "mappings": { + "properties": { + "content": { + "type": "text", + "analyzer": "english" + } } + } } -------------------------------------------------- // NOTCONSOLE @@ -119,16 +119,16 @@ And we ran the following query with a highlight request: -------------------------------------------------- GET test_index/_search { - "query": { - "match_phrase" : {"content" : "only fox"} - }, - "highlight": { - "type" : "unified", - "number_of_fragments" : 3, - "fields": { - "content": {} - } + "query": { + "match_phrase" : {"content" : "only fox"} + }, + "highlight": { + "type" : "unified", + "number_of_fragments" : 3, + "fields": { + "content": {} } + } } -------------------------------------------------- // NOTCONSOLE diff --git a/docs/reference/search/request/highlighting.asciidoc b/docs/reference/search/request/highlighting.asciidoc index 8406a771217..4d6f55dd801 100644 --- a/docs/reference/search/request/highlighting.asciidoc +++ b/docs/reference/search/request/highlighting.asciidoc @@ -24,14 +24,14 @@ the request body that specifies the `content` field: -------------------------------------------------- GET /_search { - "query" : { - "match": { "content": "kimchy" } - }, - "highlight" : { - "fields" : { - "content" : {} - } + "query": { + "match": { "content": "kimchy" } + }, + "highlight": { + "fields": { + "content": {} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -279,19 +279,19 @@ individual fields. -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "number_of_fragments" : 3, - "fragment_size" : 150, - "fields" : { - "body" : { "pre_tags" : [""], "post_tags" : [""] }, - "blog.title" : { "number_of_fragments" : 0 }, - "blog.author" : { "number_of_fragments" : 0 }, - "blog.comment" : { "number_of_fragments" : 5, "order" : "score" } - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "number_of_fragments" : 3, + "fragment_size" : 150, + "fields" : { + "body" : { "pre_tags" : [""], "post_tags" : [""] }, + "blog.title" : { "number_of_fragments" : 0 }, + "blog.author" : { "number_of_fragments" : 0 }, + "blog.comment" : { "number_of_fragments" : 5, "order" : "score" } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -309,58 +309,58 @@ highlighting would only take the search query into account. -------------------------------------------------- GET /_search { - "query" : { - "match": { - "comment": { - "query": "foo bar" - } - } - }, - "rescore": { - "window_size": 50, - "query": { - "rescore_query" : { - "match_phrase": { - "comment": { - "query": "foo bar", - "slop": 1 - } - } - }, - "rescore_query_weight" : 10 - } - }, - "_source": false, - "highlight" : { - "order" : "score", - "fields" : { - "comment" : { - "fragment_size" : 150, - "number_of_fragments" : 3, - "highlight_query": { - "bool": { - "must": { - "match": { - "comment": { - "query": "foo bar" - } - } - }, - "should": { - "match_phrase": { - "comment": { - "query": "foo bar", - "slop": 1, - "boost": 10.0 - } - } - }, - "minimum_should_match": 0 - } - } - } - } + "query": { + "match": { + "comment": { + "query": "foo bar" + } } + }, + "rescore": { + "window_size": 50, + "query": { + "rescore_query": { + "match_phrase": { + "comment": { + "query": "foo bar", + "slop": 1 + } + } + }, + "rescore_query_weight": 10 + } + }, + "_source": false, + "highlight": { + "order": "score", + "fields": { + "comment": { + "fragment_size": 150, + "number_of_fragments": 3, + "highlight_query": { + "bool": { + "must": { + "match": { + "comment": { + "query": "foo bar" + } + } + }, + "should": { + "match_phrase": { + "comment": { + "query": "foo bar", + "slop": 1, + "boost": 10.0 + } + } + }, + "minimum_should_match": 0 + } + } + } + } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -377,14 +377,14 @@ The following is an example that forces the use of the plain highlighter: -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "fields" : { - "comment" : {"type" : "plain"} - } + "query": { + "match": { "user": "kimchy" } + }, + "highlight": { + "fields": { + "comment": { "type": "plain" } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -401,16 +401,16 @@ for example: -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "pre_tags" : [""], - "post_tags" : [""], - "fields" : { - "body" : {} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "pre_tags" : [""], + "post_tags" : [""], + "fields" : { + "body" : {} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -422,16 +422,16 @@ When using the fast vector highlighter, you can specify additional tags and the -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "pre_tags" : ["", ""], - "post_tags" : ["", ""], - "fields" : { - "body" : {} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "pre_tags" : ["", ""], + "post_tags" : ["", ""], + "fields" : { + "body" : {} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -442,15 +442,15 @@ You can also use the built-in `styled` tag schema: -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "tags_schema" : "styled", - "fields" : { - "comment" : {} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "tags_schema" : "styled", + "fields" : { + "comment" : {} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -466,14 +466,14 @@ are stored separately. Defaults to `false`. -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "fields" : { - "comment" : {"force_source" : true} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "fields" : { + "comment" : {"force_source" : true} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -490,15 +490,15 @@ By default, only fields that contains a query match are highlighted. Set -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "require_field_match": false, - "fields": { - "body" : { "pre_tags" : [""], "post_tags" : [""] } - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "require_field_match": false, + "fields": { + "body" : { "pre_tags" : [""], "post_tags" : [""] } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -523,21 +523,21 @@ analyzer and `comment.plain` is analyzed by the `standard` analyzer. -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "query": "comment.plain:running scissors", - "fields": ["comment"] - } - }, - "highlight": { - "order": "score", - "fields": { - "comment": { - "matched_fields": ["comment", "comment.plain"], - "type" : "fvh" - } - } + "query": { + "query_string": { + "query": "comment.plain:running scissors", + "fields": [ "comment" ] } + }, + "highlight": { + "order": "score", + "fields": { + "comment": { + "matched_fields": [ "comment", "comment.plain" ], + "type": "fvh" + } + } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -552,21 +552,21 @@ are more matches in that fragment. -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "query": "running scissors", - "fields": ["comment", "comment.plain^10"] - } - }, - "highlight": { - "order": "score", - "fields": { - "comment": { - "matched_fields": ["comment", "comment.plain"], - "type" : "fvh" - } - } + "query": { + "query_string": { + "query": "running scissors", + "fields": ["comment", "comment.plain^10"] } + }, + "highlight": { + "order": "score", + "fields": { + "comment": { + "matched_fields": ["comment", "comment.plain"], + "type" : "fvh" + } + } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -579,21 +579,21 @@ the plain match ("running") is boosted. -------------------------------------------------- GET /_search { - "query": { - "query_string": { - "query": "running scissors", - "fields": ["comment", "comment.plain^10"] - } - }, - "highlight": { - "order": "score", - "fields": { - "comment": { - "matched_fields": ["comment.plain"], - "type" : "fvh" - } - } + "query": { + "query_string": { + "query": "running scissors", + "fields": [ "comment", "comment.plain^10" ] } + }, + "highlight": { + "order": "score", + "fields": { + "comment": { + "matched_fields": [ "comment.plain" ], + "type": "fvh" + } + } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -648,12 +648,12 @@ in which fields are highlighted specify the `fields` as an array: -------------------------------------------------- GET /_search { - "highlight": { - "fields": [ - { "title": {} }, - { "text": {} } - ] - } + "highlight": { + "fields": [ + { "title": {} }, + { "text": {} } + ] + } } -------------------------------------------------- // TEST[setup:twitter] @@ -677,14 +677,14 @@ For example: -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "fields" : { - "comment" : {"fragment_size" : 150, "number_of_fragments" : 3} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "fields" : { + "comment" : {"fragment_size" : 150, "number_of_fragments" : 3} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -696,15 +696,15 @@ to be sorted by score: -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "order" : "score", - "fields" : { - "comment" : {"fragment_size" : 150, "number_of_fragments" : 3} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "order" : "score", + "fields" : { + "comment" : {"fragment_size" : 150, "number_of_fragments" : 3} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -719,15 +719,15 @@ is required. Note that `fragment_size` is ignored in this case. -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "fields" : { - "body" : {}, - "blog.title" : {"number_of_fragments" : 0} - } + "query" : { + "match": { "user": "kimchy" } + }, + "highlight" : { + "fields" : { + "body" : {}, + "blog.title" : {"number_of_fragments" : 0} } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -745,18 +745,18 @@ specified as it tries to break on a word boundary. -------------------------------------------------- GET /_search { - "query" : { - "match": { "user": "kimchy" } - }, - "highlight" : { - "fields" : { - "comment" : { - "fragment_size" : 150, - "number_of_fragments" : 3, - "no_match_size": 150 - } - } + "query": { + "match": { "user": "kimchy" } + }, + "highlight": { + "fields": { + "comment": { + "fragment_size": 150, + "number_of_fragments": 3, + "no_match_size": 150 + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -812,19 +812,19 @@ When using the `plain` highlighter, you can choose between the `simple` and -------------------------------------------------- GET twitter/_search { - "query" : { - "match_phrase": { "message": "number 1" } - }, - "highlight" : { - "fields" : { - "message" : { - "type": "plain", - "fragment_size" : 15, - "number_of_fragments" : 3, - "fragmenter": "simple" - } - } + "query": { + "match_phrase": { "message": "number 1" } + }, + "highlight": { + "fields": { + "message": { + "type": "plain", + "fragment_size": 15, + "number_of_fragments": 3, + "fragmenter": "simple" + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -834,34 +834,34 @@ Response: [source,console-result] -------------------------------------------------- { - ... - "hits": { - "total" : { - "value": 1, - "relation": "eq" + ... + "hits": { + "total": { + "value": 1, + "relation": "eq" + }, + "max_score": 1.6011951, + "hits": [ + { + "_index": "twitter", + "_type": "_doc", + "_id": "1", + "_score": 1.6011951, + "_source": { + "user": "test", + "message": "some message with the number 1", + "date": "2009-11-15T14:12:12", + "likes": 1 }, - "max_score": 1.6011951, - "hits": [ - { - "_index": "twitter", - "_type": "_doc", - "_id": "1", - "_score": 1.6011951, - "_source": { - "user": "test", - "message": "some message with the number 1", - "date": "2009-11-15T14:12:12", - "likes": 1 - }, - "highlight": { - "message": [ - " with the number", - " 1" - ] - } - } - ] - } + "highlight": { + "message": [ + " with the number", + " 1" + ] + } + } + ] + } } -------------------------------------------------- // TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,/] @@ -870,19 +870,19 @@ Response: -------------------------------------------------- GET twitter/_search { - "query" : { - "match_phrase": { "message": "number 1" } - }, - "highlight" : { - "fields" : { - "message" : { - "type": "plain", - "fragment_size" : 15, - "number_of_fragments" : 3, - "fragmenter": "span" - } - } + "query": { + "match_phrase": { "message": "number 1" } + }, + "highlight": { + "fields": { + "message": { + "type": "plain", + "fragment_size": 15, + "number_of_fragments": 3, + "fragmenter": "span" + } } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -892,33 +892,33 @@ Response: [source,console-result] -------------------------------------------------- { - ... - "hits": { - "total" : { - "value": 1, - "relation": "eq" + ... + "hits": { + "total": { + "value": 1, + "relation": "eq" + }, + "max_score": 1.6011951, + "hits": [ + { + "_index": "twitter", + "_type": "_doc", + "_id": "1", + "_score": 1.6011951, + "_source": { + "user": "test", + "message": "some message with the number 1", + "date": "2009-11-15T14:12:12", + "likes": 1 }, - "max_score": 1.6011951, - "hits": [ - { - "_index": "twitter", - "_type": "_doc", - "_id": "1", - "_score": 1.6011951, - "_source": { - "user": "test", - "message": "some message with the number 1", - "date": "2009-11-15T14:12:12", - "likes": 1 - }, - "highlight": { - "message": [ - " with the number 1" - ] - } - } - ] - } + "highlight": { + "message": [ + " with the number 1" + ] + } + } + ] + } } -------------------------------------------------- // TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,/] diff --git a/docs/reference/search/request/index-boost.asciidoc b/docs/reference/search/request/index-boost.asciidoc index 95b745f2628..85442ca8c75 100644 --- a/docs/reference/search/request/index-boost.asciidoc +++ b/docs/reference/search/request/index-boost.asciidoc @@ -11,10 +11,10 @@ deprecated[5.2.0, This format is deprecated. Please use array format instead.] -------------------------------------------------- GET /_search { - "indices_boost" : { - "index1" : 1.4, - "index2" : 1.3 - } + "indices_boost" : { + "index1" : 1.4, + "index2" : 1.3 + } } -------------------------------------------------- // TEST[setup:index_boost warning:Object format in indices_boost is deprecated, please use array format instead] @@ -25,10 +25,10 @@ You can also specify it as an array to control the order of boosts. -------------------------------------------------- GET /_search { - "indices_boost" : [ - { "alias1" : 1.4 }, - { "index*" : 1.3 } - ] + "indices_boost" : [ + { "alias1" : 1.4 }, + { "index*" : 1.3 } + ] } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/search/request/inner-hits.asciidoc b/docs/reference/search/request/inner-hits.asciidoc index 5f7f3bdc9ea..5c3878f1a60 100644 --- a/docs/reference/search/request/inner-hits.asciidoc +++ b/docs/reference/search/request/inner-hits.asciidoc @@ -17,9 +17,9 @@ The structure looks like this: [source,js] -------------------------------------------------- "" : { - "inner_hits" : { - - } + "inner_hits" : { + + } } -------------------------------------------------- // NOTCONSOLE @@ -29,28 +29,28 @@ If `inner_hits` is defined on a query that supports it then each search hit will [source,js] -------------------------------------------------- "hits": [ - { - "_index": ..., - "_type": ..., - "_id": ..., - "inner_hits": { - "": { - "hits": { - "total": ..., - "hits": [ - { - "_type": ..., - "_id": ..., - ... - }, - ... - ] - } - } - }, - ... - }, - ... + { + "_index": ..., + "_type": ..., + "_id": ..., + "inner_hits": { + "": { + "hits": { + "total": ..., + "hits": [ + { + "_type": ..., + "_id": ..., + ... + }, + ... + ] + } + } + }, + ... + }, + ... ] -------------------------------------------------- // NOTCONSOLE @@ -117,7 +117,7 @@ POST test/_search "nested": { "path": "comments", "query": { - "match": {"comments.number" : 2} + "match": { "comments.number": 2 } }, "inner_hits": {} <1> } @@ -134,9 +134,9 @@ An example of a response snippet that could be generated from the above search r { ..., "hits": { - "total" : { - "value": 1, - "relation": "eq" + "total": { + "value": 1, + "relation": "eq" }, "max_score": 1.0, "hits": [ @@ -149,9 +149,9 @@ An example of a response snippet that could be generated from the above search r "inner_hits": { "comments": { <1> "hits": { - "total" : { - "value": 1, - "relation": "eq" + "total": { + "value": 1, + "relation": "eq" }, "max_score": 1.0, "hits": [ @@ -240,11 +240,11 @@ POST test/_search "nested": { "path": "comments", "query": { - "match": {"comments.text" : "words"} + "match": { "comments.text": "words" } }, "inner_hits": { - "_source" : false, - "docvalue_fields" : [ + "_source": false, + "docvalue_fields": [ "comments.text.keyword" ] } @@ -262,9 +262,9 @@ Response not included in text but tested for completeness sake. { ..., "hits": { - "total" : { - "value": 1, - "relation": "eq" + "total": { + "value": 1, + "relation": "eq" }, "max_score": 1.0444684, "hits": [ @@ -277,7 +277,7 @@ Response not included in text but tested for completeness sake. "inner_hits": { "comments": { <1> "hits": { - "total" : { + "total": { "value": 1, "relation": "eq" }, @@ -492,53 +492,53 @@ An example of a response snippet that could be generated from the above search r [source,console-result] -------------------------------------------------- { - ..., - "hits": { - "total" : { - "value": 1, - "relation": "eq" + ..., + "hits": { + "total": { + "value": 1, + "relation": "eq" + }, + "max_score": 1.0, + "hits": [ + { + "_index": "test", + "_type": "_doc", + "_id": "1", + "_score": 1.0, + "_source": { + "number": 1, + "my_join_field": "my_parent" }, - "max_score": 1.0, - "hits": [ - { - "_index": "test", - "_type": "_doc", - "_id": "1", - "_score": 1.0, - "_source": { + "inner_hits": { + "my_child": { + "hits": { + "total": { + "value": 1, + "relation": "eq" + }, + "max_score": 1.0, + "hits": [ + { + "_index": "test", + "_type": "_doc", + "_id": "2", + "_score": 1.0, + "_routing": "1", + "_source": { "number": 1, - "my_join_field": "my_parent" - }, - "inner_hits": { - "my_child": { - "hits": { - "total" : { - "value": 1, - "relation": "eq" - }, - "max_score": 1.0, - "hits": [ - { - "_index": "test", - "_type": "_doc", - "_id": "2", - "_score": 1.0, - "_routing": "1", - "_source": { - "number": 1, - "my_join_field": { - "name": "my_child", - "parent": "1" - } - } - } - ] - } + "my_join_field": { + "name": "my_child", + "parent": "1" } + } } + ] } - ] - } + } + } + } + ] + } } -------------------------------------------------- // TESTRESPONSE[s/"_source": \.\.\./"_source": $body.hits.hits.0._source/] diff --git a/docs/reference/search/request/min-score.asciidoc b/docs/reference/search/request/min-score.asciidoc index 503e114d4db..8423d9f5e19 100644 --- a/docs/reference/search/request/min-score.asciidoc +++ b/docs/reference/search/request/min-score.asciidoc @@ -8,10 +8,10 @@ in `min_score`: -------------------------------------------------- GET /_search { - "min_score": 0.5, - "query" : { - "term" : { "user" : "kimchy" } - } + "min_score": 0.5, + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- diff --git a/docs/reference/search/request/named-queries-and-filters.asciidoc b/docs/reference/search/request/named-queries-and-filters.asciidoc index 97b6969ea19..1482e434d3a 100644 --- a/docs/reference/search/request/named-queries-and-filters.asciidoc +++ b/docs/reference/search/request/named-queries-and-filters.asciidoc @@ -7,20 +7,20 @@ Each filter and query can accept a `_name` in its top level definition. -------------------------------------------------- GET /_search { - "query": { - "bool" : { - "should" : [ - {"match" : { "name.first" : {"query" : "shay", "_name" : "first"} }}, - {"match" : { "name.last" : {"query" : "banon", "_name" : "last"} }} - ], - "filter" : { - "terms" : { - "name.last" : ["banon", "kimchy"], - "_name" : "test" - } - } + "query": { + "bool": { + "should": [ + { "match": { "name.first": { "query": "shay", "_name": "first" } } }, + { "match": { "name.last": { "query": "banon", "_name": "last" } } } + ], + "filter": { + "terms": { + "name.last": [ "banon", "kimchy" ], + "_name": "test" } + } } + } } -------------------------------------------------- diff --git a/docs/reference/search/request/post-filter.asciidoc b/docs/reference/search/request/post-filter.asciidoc index db143869c26..3e7c01e28a7 100644 --- a/docs/reference/search/request/post-filter.asciidoc +++ b/docs/reference/search/request/post-filter.asciidoc @@ -11,20 +11,20 @@ Imagine that you are selling shirts that have the following properties: -------------------------------------------------- PUT /shirts { - "mappings": { - "properties": { - "brand": { "type": "keyword"}, - "color": { "type": "keyword"}, - "model": { "type": "keyword"} - } + "mappings": { + "properties": { + "brand": { "type": "keyword"}, + "color": { "type": "keyword"}, + "model": { "type": "keyword"} } + } } PUT /shirts/_doc/1?refresh { - "brand": "gucci", - "color": "red", - "model": "slim" + "brand": "gucci", + "color": "red", + "model": "slim" } -------------------------------------------------- // TESTSETUP diff --git a/docs/reference/search/request/preference.asciidoc b/docs/reference/search/request/preference.asciidoc index 7c64bf8d2ce..78cbfb67a2d 100644 --- a/docs/reference/search/request/preference.asciidoc +++ b/docs/reference/search/request/preference.asciidoc @@ -59,11 +59,11 @@ For instance, use the user's session ID `xyzabc123` as follows: ------------------------------------------------ GET /_search?preference=xyzabc123 { - "query": { - "match": { - "title": "elasticsearch" - } + "query": { + "match": { + "title": "elasticsearch" } + } } ------------------------------------------------ diff --git a/docs/reference/search/request/script-fields.asciidoc b/docs/reference/search/request/script-fields.asciidoc index 0078400b003..abbd663f04c 100644 --- a/docs/reference/search/request/script-fields.asciidoc +++ b/docs/reference/search/request/script-fields.asciidoc @@ -8,26 +8,26 @@ evaluation>> (based on different fields) for each hit, for example: -------------------------------------------------- GET /_search { - "query" : { - "match_all": {} + "query": { + "match_all": {} + }, + "script_fields": { + "test1": { + "script": { + "lang": "painless", + "source": "doc['price'].value * 2" + } }, - "script_fields" : { - "test1" : { - "script" : { - "lang": "painless", - "source": "doc['price'].value * 2" - } - }, - "test2" : { - "script" : { - "lang": "painless", - "source": "doc['price'].value * params.factor", - "params" : { - "factor" : 2.0 - } - } + "test2": { + "script": { + "lang": "painless", + "source": "doc['price'].value * params.factor", + "params": { + "factor": 2.0 } + } } + } } -------------------------------------------------- // TEST[setup:sales] diff --git a/docs/reference/search/request/scroll.asciidoc b/docs/reference/search/request/scroll.asciidoc index 12dbfa3d58f..9c66c61e99a 100644 --- a/docs/reference/search/request/scroll.asciidoc +++ b/docs/reference/search/request/scroll.asciidoc @@ -45,12 +45,12 @@ should keep the ``search context'' alive (see <>), eg `?s -------------------------------------------------- POST /twitter/_search?scroll=1m { - "size": 100, - "query": { - "match" : { - "title" : "elasticsearch" - } + "size": 100, + "query": { + "match": { + "title": "elasticsearch" } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -61,10 +61,10 @@ results. [source,console] -------------------------------------------------- -POST /_search/scroll <1> +POST /_search/scroll <1> { - "scroll" : "1m", <2> - "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" <3> + "scroll" : "1m", <2> + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" <3> } -------------------------------------------------- // TEST[continued s/DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==/$body._scroll_id/] @@ -161,7 +161,7 @@ cleared as soon as the scroll is not being used anymore using the --------------------------------------- DELETE /_search/scroll { - "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" } --------------------------------------- // TEST[catch:missing] @@ -172,10 +172,10 @@ Multiple scroll IDs can be passed as array: --------------------------------------- DELETE /_search/scroll { - "scroll_id" : [ - "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", - "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB" - ] + "scroll_id" : [ + "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==", + "DnF1ZXJ5VGhlbkZldGNoBQAAAAAAAAABFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAAAxZrUllkUVlCa1NqNmRMaUhiQlZkMWFBAAAAAAAAAAIWa1JZZFFZQmtTajZkTGlIYkJWZDFhQQAAAAAAAAAFFmtSWWRRWUJrU2o2ZExpSGJCVmQxYUEAAAAAAAAABBZrUllkUVlCa1NqNmRMaUhiQlZkMWFB" + ] } --------------------------------------- // TEST[catch:missing] @@ -206,27 +206,27 @@ can be consumed independently: -------------------------------------------------- GET /twitter/_search?scroll=1m { - "slice": { - "id": 0, <1> - "max": 2 <2> - }, - "query": { - "match" : { - "title" : "elasticsearch" - } + "slice": { + "id": 0, <1> + "max": 2 <2> + }, + "query": { + "match": { + "title": "elasticsearch" } + } } GET /twitter/_search?scroll=1m { - "slice": { - "id": 1, - "max": 2 - }, - "query": { - "match" : { - "title" : "elasticsearch" - } + "slice": { + "id": 1, + "max": 2 + }, + "query": { + "match": { + "title": "elasticsearch" } + } } -------------------------------------------------- // TEST[setup:big_twitter] @@ -268,16 +268,16 @@ slice gets deterministic results. -------------------------------------------------- GET /twitter/_search?scroll=1m { - "slice": { - "field": "date", - "id": 0, - "max": 10 - }, - "query": { - "match" : { - "title" : "elasticsearch" - } + "slice": { + "field": "date", + "id": 0, + "max": 10 + }, + "query": { + "match": { + "title": "elasticsearch" } + } } -------------------------------------------------- // TEST[setup:big_twitter] diff --git a/docs/reference/search/request/search-after.asciidoc b/docs/reference/search/request/search-after.asciidoc index 76313dee518..3196ac6dae2 100644 --- a/docs/reference/search/request/search-after.asciidoc +++ b/docs/reference/search/request/search-after.asciidoc @@ -14,16 +14,16 @@ Suppose that the query to retrieve the first page looks like this: -------------------------------------------------- GET twitter/_search { - "size": 10, - "query": { - "match" : { - "title" : "elasticsearch" - } - }, - "sort": [ - {"date": "asc"}, - {"tie_breaker_id": "asc"} <1> - ] + "size": 10, + "query": { + "match" : { + "title" : "elasticsearch" + } + }, + "sort": [ + {"date": "asc"}, + {"tie_breaker_id": "asc"} <1> + ] } -------------------------------------------------- // TEST[setup:twitter] @@ -57,17 +57,17 @@ For instance we can use the `sort values` of the last document and pass it to `s -------------------------------------------------- GET twitter/_search { - "size": 10, - "query": { - "match" : { - "title" : "elasticsearch" - } - }, - "search_after": [1463538857, "654323"], - "sort": [ - {"date": "asc"}, - {"tie_breaker_id": "asc"} - ] + "size": 10, + "query": { + "match" : { + "title" : "elasticsearch" + } + }, + "search_after": [1463538857, "654323"], + "sort": [ + {"date": "asc"}, + {"tie_breaker_id": "asc"} + ] } -------------------------------------------------- // TEST[setup:twitter] diff --git a/docs/reference/search/request/sort.asciidoc b/docs/reference/search/request/sort.asciidoc index a845902d12f..aa338438e46 100644 --- a/docs/reference/search/request/sort.asciidoc +++ b/docs/reference/search/request/sort.asciidoc @@ -11,18 +11,18 @@ Assuming the following index mapping: -------------------------------------------------- PUT /my_index { - "mappings": { - "properties": { - "post_date": { "type": "date" }, - "user": { - "type": "keyword" - }, - "name": { - "type": "keyword" - }, - "age": { "type": "integer" } - } + "mappings": { + "properties": { + "post_date": { "type": "date" }, + "user": { + "type": "keyword" + }, + "name": { + "type": "keyword" + }, + "age": { "type": "integer" } } + } } -------------------------------------------------- @@ -30,16 +30,16 @@ PUT /my_index -------------------------------------------------- GET /my_index/_search { - "sort" : [ - { "post_date" : {"order" : "asc"}}, - "user", - { "name" : "desc" }, - { "age" : "desc" }, - "_score" - ], - "query" : { - "term" : { "user" : "kimchy" } - } + "sort" : [ + { "post_date" : {"order" : "asc"}}, + "user", + { "name" : "desc" }, + { "age" : "desc" }, + "_score" + ], + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- // TEST[continued] @@ -122,11 +122,11 @@ Consider for instance these two indices: -------------------------------------------------- PUT /index_double { - "mappings": { - "properties": { - "field": { "type": "double" } - } + "mappings": { + "properties": { + "field": { "type": "double" } } + } } -------------------------------------------------- @@ -134,11 +134,11 @@ PUT /index_double -------------------------------------------------- PUT /index_long { - "mappings": { - "properties": { - "field": { "type": "long" } - } + "mappings": { + "properties": { + "field": { "type": "long" } } + } } -------------------------------------------------- // TEST[continued] @@ -180,11 +180,11 @@ Consider for instance these two indices: -------------------------------------------------- PUT /index_double { - "mappings": { - "properties": { - "field": { "type": "date" } - } + "mappings": { + "properties": { + "field": { "type": "date" } } + } } -------------------------------------------------- @@ -192,11 +192,11 @@ PUT /index_double -------------------------------------------------- PUT /index_long { - "mappings": { - "properties": { - "field": { "type": "date_nanos" } - } + "mappings": { + "properties": { + "field": { "type": "date_nanos" } } + } } -------------------------------------------------- // TEST[continued] @@ -351,12 +351,12 @@ For example: -------------------------------------------------- GET /_search { - "sort" : [ - { "price" : {"missing" : "_last"} } - ], - "query" : { - "term" : { "product" : "chocolate" } - } + "sort" : [ + { "price" : {"missing" : "_last"} } + ], + "query" : { + "term" : { "product" : "chocolate" } + } } -------------------------------------------------- @@ -375,12 +375,12 @@ example of how it can be used: -------------------------------------------------- GET /_search { - "sort" : [ - { "price" : {"unmapped_type" : "long"} } - ], - "query" : { - "term" : { "product" : "chocolate" } - } + "sort" : [ + { "price" : {"unmapped_type" : "long"} } + ], + "query" : { + "term" : { "product" : "chocolate" } + } } -------------------------------------------------- @@ -397,21 +397,21 @@ Allow to sort by `_geo_distance`. Here is an example, assuming `pin.location` is -------------------------------------------------- GET /_search { - "sort" : [ - { - "_geo_distance" : { - "pin.location" : [-70, 40], - "order" : "asc", - "unit" : "km", - "mode" : "min", - "distance_type" : "arc", - "ignore_unmapped": true - } - } - ], - "query" : { - "term" : { "user" : "kimchy" } + "sort" : [ + { + "_geo_distance" : { + "pin.location" : [-70, 40], + "order" : "asc", + "unit" : "km", + "mode" : "min", + "distance_type" : "arc", + "ignore_unmapped": true + } } + ], + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- @@ -450,21 +450,21 @@ The following formats are supported in providing the coordinates: -------------------------------------------------- GET /_search { - "sort" : [ - { - "_geo_distance" : { - "pin.location" : { - "lat" : 40, - "lon" : -70 - }, - "order" : "asc", - "unit" : "km" - } - } - ], - "query" : { - "term" : { "user" : "kimchy" } + "sort" : [ + { + "_geo_distance" : { + "pin.location" : { + "lat" : 40, + "lon" : -70 + }, + "order" : "asc", + "unit" : "km" + } } + ], + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- @@ -476,18 +476,18 @@ Format in `lat,lon`. -------------------------------------------------- GET /_search { - "sort" : [ - { - "_geo_distance" : { - "pin.location" : "40,-70", - "order" : "asc", - "unit" : "km" - } - } - ], - "query" : { - "term" : { "user" : "kimchy" } + "sort": [ + { + "_geo_distance": { + "pin.location": "40,-70", + "order": "asc", + "unit": "km" + } } + ], + "query": { + "term": { "user": "kimchy" } + } } -------------------------------------------------- @@ -497,18 +497,18 @@ GET /_search -------------------------------------------------- GET /_search { - "sort" : [ - { - "_geo_distance" : { - "pin.location" : "drm3btev3e86", - "order" : "asc", - "unit" : "km" - } - } - ], - "query" : { - "term" : { "user" : "kimchy" } + "sort": [ + { + "_geo_distance": { + "pin.location": "drm3btev3e86", + "order": "asc", + "unit": "km" + } } + ], + "query": { + "term": { "user": "kimchy" } + } } -------------------------------------------------- @@ -521,18 +521,18 @@ conform with http://geojson.org/[GeoJSON]. -------------------------------------------------- GET /_search { - "sort" : [ - { - "_geo_distance" : { - "pin.location" : [-70, 40], - "order" : "asc", - "unit" : "km" - } - } - ], - "query" : { - "term" : { "user" : "kimchy" } + "sort": [ + { + "_geo_distance": { + "pin.location": [ -70, 40 ], + "order": "asc", + "unit": "km" + } } + ], + "query": { + "term": { "user": "kimchy" } + } } -------------------------------------------------- @@ -545,18 +545,18 @@ Multiple geo points can be passed as an array containing any `geo_point` format, -------------------------------------------------- GET /_search { - "sort" : [ - { - "_geo_distance" : { - "pin.location" : [[-70, 40], [-71, 42]], - "order" : "asc", - "unit" : "km" - } - } - ], - "query" : { - "term" : { "user" : "kimchy" } + "sort": [ + { + "_geo_distance": { + "pin.location": [ [ -70, 40 ], [ -71, 42 ] ], + "order": "asc", + "unit": "km" + } } + ], + "query": { + "term": { "user": "kimchy" } + } } -------------------------------------------------- @@ -574,22 +574,22 @@ Allow to sort based on custom scripts, here is an example: -------------------------------------------------- GET /_search { - "query" : { - "term" : { "user" : "kimchy" } - }, - "sort" : { - "_script" : { - "type" : "number", - "script" : { - "lang": "painless", - "source": "doc['field_name'].value * params.factor", - "params" : { - "factor" : 1.1 - } - }, - "order" : "asc" + "query": { + "term": { "user": "kimchy" } + }, + "sort": { + "_script": { + "type": "number", + "script": { + "lang": "painless", + "source": "doc['field_name'].value * params.factor", + "params": { + "factor": 1.1 } + }, + "order": "asc" } + } } -------------------------------------------------- @@ -603,15 +603,15 @@ When sorting on a field, scores are not computed. By setting -------------------------------------------------- GET /_search { - "track_scores": true, - "sort" : [ - { "post_date" : {"order" : "desc"} }, - { "name" : "desc" }, - { "age" : "desc" } - ], - "query" : { - "term" : { "user" : "kimchy" } - } + "track_scores": true, + "sort" : [ + { "post_date" : {"order" : "desc"} }, + { "name" : "desc" }, + { "age" : "desc" } + ], + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- diff --git a/docs/reference/search/request/stored-fields.asciidoc b/docs/reference/search/request/stored-fields.asciidoc index 42243434554..1894a52fade 100644 --- a/docs/reference/search/request/stored-fields.asciidoc +++ b/docs/reference/search/request/stored-fields.asciidoc @@ -13,10 +13,10 @@ by a search hit. -------------------------------------------------- GET /_search { - "stored_fields" : ["user", "postDate"], - "query" : { - "term" : { "user" : "kimchy" } - } + "stored_fields" : ["user", "postDate"], + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- @@ -29,10 +29,10 @@ returned, for example: -------------------------------------------------- GET /_search { - "stored_fields" : [], - "query" : { - "term" : { "user" : "kimchy" } - } + "stored_fields" : [], + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- @@ -55,10 +55,10 @@ To disable the stored fields (and metadata fields) entirely use: `_none_`: -------------------------------------------------- GET /_search { - "stored_fields": "_none_", - "query" : { - "term" : { "user" : "kimchy" } - } + "stored_fields": "_none_", + "query" : { + "term" : { "user" : "kimchy" } + } } -------------------------------------------------- diff --git a/docs/reference/search/request/track-total-hits.asciidoc b/docs/reference/search/request/track-total-hits.asciidoc index a1e76580de2..25dff4d990e 100644 --- a/docs/reference/search/request/track-total-hits.asciidoc +++ b/docs/reference/search/request/track-total-hits.asciidoc @@ -23,12 +23,12 @@ that `"total.value"` is the accurate count. -------------------------------------------------- GET twitter/_search { - "track_total_hits": true, - "query": { - "match" : { - "message" : "Elasticsearch" - } - } + "track_total_hits": true, + "query": { + "match" : { + "message" : "Elasticsearch" + } + } } -------------------------------------------------- // TEST[setup:twitter] @@ -38,17 +38,17 @@ GET twitter/_search [source,console-result] -------------------------------------------------- { - "_shards": ... - "timed_out": false, - "took": 100, - "hits": { - "max_score": 1.0, - "total" : { - "value": 2048, <1> - "relation": "eq" <2> - }, - "hits": ... - } + "_shards": ... + "timed_out": false, + "took": 100, + "hits": { + "max_score": 1.0, + "total" : { + "value": 2048, <1> + "relation": "eq" <2> + }, + "hits": ... + } } -------------------------------------------------- // TESTRESPONSE[s/"_shards": \.\.\./"_shards": "$body._shards",/] @@ -68,12 +68,12 @@ the query up to 100 documents: -------------------------------------------------- GET twitter/_search { - "track_total_hits": 100, - "query": { - "match" : { - "message" : "Elasticsearch" - } - } + "track_total_hits": 100, + "query": { + "match": { + "message": "Elasticsearch" + } + } } -------------------------------------------------- // TEST[continued] @@ -87,17 +87,17 @@ For instance the following response: [source,console-result] -------------------------------------------------- { - "_shards": ... - "timed_out": false, - "took": 30, - "hits" : { - "max_score": 1.0, - "total" : { - "value": 42, <1> - "relation": "eq" <2> - }, - "hits": ... - } + "_shards": ... + "timed_out": false, + "took": 30, + "hits": { + "max_score": 1.0, + "total": { + "value": 42, <1> + "relation": "eq" <2> + }, + "hits": ... + } } -------------------------------------------------- // TESTRESPONSE[s/"_shards": \.\.\./"_shards": "$body._shards",/] @@ -119,15 +119,15 @@ will indicate that the returned value is a lower bound: [source,console-result] -------------------------------------------------- { - "_shards": ... - "hits" : { - "max_score": 1.0, - "total" : { - "value": 100, <1> - "relation": "gte" <2> - }, - "hits": ... - } + "_shards": ... + "hits": { + "max_score": 1.0, + "total": { + "value": 100, <1> + "relation": "gte" <2> + }, + "hits": ... + } } -------------------------------------------------- // TESTRESPONSE[skip:response is already tested in the previous snippet] @@ -142,12 +142,12 @@ times by setting this option to `false`: -------------------------------------------------- GET twitter/_search { - "track_total_hits": false, - "query": { - "match" : { - "message" : "Elasticsearch" - } - } + "track_total_hits": false, + "query": { + "match": { + "message": "Elasticsearch" + } + } } -------------------------------------------------- // TEST[continued] @@ -157,13 +157,13 @@ GET twitter/_search [source,console-result] -------------------------------------------------- { - "_shards": ... - "timed_out": false, - "took": 10, - "hits" : { <1> - "max_score": 1.0, - "hits": ... - } + "_shards": ... + "timed_out": false, + "took": 10, + "hits": { <1> + "max_score": 1.0, + "hits": ... + } } -------------------------------------------------- // TESTRESPONSE[s/"_shards": \.\.\./"_shards": "$body._shards",/] diff --git a/docs/reference/search/run-a-search.asciidoc b/docs/reference/search/run-a-search.asciidoc index 278945c755e..fc658ba2f4e 100644 --- a/docs/reference/search/run-a-search.asciidoc +++ b/docs/reference/search/run-a-search.asciidoc @@ -261,9 +261,9 @@ GET /_all/_search GET /*/_search { - "query" : { - "match" : { "message" : "login" } - } + "query" : { + "match" : { "message" : "login" } + } } ---- // TEST[continued] diff --git a/docs/reference/search/scroll-api.asciidoc b/docs/reference/search/scroll-api.asciidoc index d5f31eae1fb..6b16e639930 100644 --- a/docs/reference/search/scroll-api.asciidoc +++ b/docs/reference/search/scroll-api.asciidoc @@ -25,7 +25,7 @@ GET /_search?scroll=1m -------------------------------------------------- GET /_search/scroll { - "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/search/search-template.asciidoc b/docs/reference/search/search-template.asciidoc index 588ef1c5ee2..d9bb9eda817 100644 --- a/docs/reference/search/search-template.asciidoc +++ b/docs/reference/search/search-template.asciidoc @@ -7,15 +7,15 @@ Allows you to use the mustache language to pre render search requests. ------------------------------------------ GET _search/template { - "source" : { - "query": { "match" : { "{{my_field}}" : "{{my_value}}" } }, - "size" : "{{my_size}}" - }, - "params" : { - "my_field" : "message", - "my_value" : "some message", - "my_size" : 5 - } + "source" : { + "query": { "match" : { "{{my_field}}" : "{{my_value}}" } }, + "size" : "{{my_size}}" + }, + "params" : { + "my_field" : "message", + "my_value" : "some message", + "my_size" : 5 + } } ------------------------------------------ // TEST[setup:twitter] @@ -112,16 +112,16 @@ You can store a search template using the stored scripts API. ------------------------------------------ POST _scripts/ { - "script": { - "lang": "mustache", - "source": { - "query": { - "match": { - "title": "{{query_string}}" - } - } + "script": { + "lang": "mustache", + "source": { + "query": { + "match": { + "title": "{{query_string}}" } + } } + } } ------------------------------------------ // TEST[continued] @@ -134,7 +134,7 @@ created: [source,console-result] -------------------------------------------------- { - "acknowledged" : true + "acknowledged" : true } -------------------------------------------------- @@ -154,15 +154,15 @@ The API returns the following result: [source,console-result] ------------------------------------------ { - "script" : { - "lang" : "mustache", - "source" : "{\"query\":{\"match\":{\"title\":\"{{query_string}}\"}}}", - "options": { - "content_type" : "application/json; charset=UTF-8" - } - }, - "_id": "", - "found": true + "script" : { + "lang" : "mustache", + "source" : "{\"query\":{\"match\":{\"title\":\"{{query_string}}\"}}}", + "options": { + "content_type" : "application/json; charset=UTF-8" + } + }, + "_id": "", + "found": true } ------------------------------------------ @@ -185,10 +185,10 @@ To use a stored template at search time send the following request: ------------------------------------------ GET _search/template { - "id": "", <1> - "params": { - "query_string": "search for these words" - } + "id": "", <1> + "params": { + "query_string": "search for these words" + } } ------------------------------------------ // TEST[catch:missing] @@ -294,16 +294,16 @@ GET _search/template ------------------------------------------ GET _search/template { - "source": { - "query": { - "term": { - "message": "{{query_string}}" - } - } - }, - "params": { - "query_string": "search for these words" + "source": { + "query": { + "term": { + "message": "{{query_string}}" + } } + }, + "params": { + "query_string": "search for these words" + } } ------------------------------------------ // TEST[setup:twitter] @@ -350,13 +350,13 @@ A more complex example substitutes an array of JSON objects: ------------------------------------------ GET _search/template { - "source": "{\"query\":{\"bool\":{\"must\": {{#toJson}}clauses{{/toJson}} }}}", - "params": { - "clauses": [ - { "term": { "user" : "foo" } }, - { "term": { "user" : "bar" } } - ] - } + "source": "{\"query\":{\"bool\":{\"must\": {{#toJson}}clauses{{/toJson}} }}}", + "params": { + "clauses": [ + { "term": { "user" : "foo" } }, + { "term": { "user" : "bar" } } + ] + } } ------------------------------------------ @@ -365,22 +365,22 @@ which is rendered as: [source,js] ------------------------------------------ { - "query" : { - "bool" : { - "must" : [ - { - "term" : { - "user" : "foo" - } - }, - { - "term" : { - "user" : "bar" - } + "query": { + "bool": { + "must": [ + { + "term": { + "user": "foo" } - ] - } + }, + { + "term": { + "user": "bar" + } + } + ] } + } } ------------------------------------------ // NOTCONSOLE @@ -413,11 +413,11 @@ which is rendered as: [source,js] ------------------------------------------ { - "query" : { - "match" : { - "emails" : "username@email.com,lastname@email.com" - } + "query" : { + "match" : { + "emails" : "username@email.com,lastname@email.com" } + } } ------------------------------------------ // NOTCONSOLE @@ -454,15 +454,15 @@ which is rendered as: [source,js] ------------------------------------------ { - "query" : { - "range" : { - "born" : { - "gte" : "2016", - "lte" : "31/12/2017", - "format" : "dd/MM/yyyy||yyyy" - } + "query": { + "range": { + "born": { + "gte": "2016", + "lte": "31/12/2017", + "format": "dd/MM/yyyy||yyyy" } } + } } ------------------------------------------ @@ -496,11 +496,11 @@ When `params` is `{ "start": 10, "end": 15 }` this query would be rendered as: [source,js] ------------------------------------------ { - "range": { - "line_no": { - "gte": "10", - "lte": "15" - } + "range": { + "line_no": { + "gte": "10", + "lte": "15" + } } } ------------------------------------------ @@ -512,12 +512,12 @@ for `end`: [source,js] ------------------------------------------ { - "range": { - "line_no": { - "gte": "10", - "lte": "20" - } + "range": { + "line_no": { + "gte": "10", + "lte": "20" } + } } ------------------------------------------ // NOTCONSOLE @@ -535,13 +535,13 @@ The `params` would look like: [source,js] ------------------------------------------ { - "params": { - "text": "words to search for", - "line_no": { <1> - "start": 10, - "end": 20 - } + "params": { + "text": "words to search for", + "line_no": { <1> + "start": 10, + "end": 20 } + } } ------------------------------------------ // NOTCONSOLE @@ -612,17 +612,17 @@ As an example, it is useful to encode a URL: ------------------------------------------ GET _render/template { - "source" : { - "query" : { - "term": { - "http_access_log": "{{#url}}{{host}}/{{page}}{{/url}}" - } - } - }, - "params": { - "host": "https://www.elastic.co/", - "page": "learn" + "source": { + "query": { + "term": { + "http_access_log": "{{#url}}{{host}}/{{page}}{{/url}}" + } } + }, + "params": { + "host": "https://www.elastic.co/", + "page": "learn" + } } ------------------------------------------ @@ -632,13 +632,13 @@ The previous query will be rendered as: [source,console-result] ------------------------------------------ { - "template_output" : { - "query" : { - "term" : { - "http_access_log" : "https%3A%2F%2Fwww.elastic.co%2F%2Flearn" - } - } + "template_output": { + "query": { + "term": { + "http_access_log": "https%3A%2F%2Fwww.elastic.co%2F%2Flearn" + } } + } } ------------------------------------------ diff --git a/docs/reference/search/suggesters/completion-suggest.asciidoc b/docs/reference/search/suggesters/completion-suggest.asciidoc index e36af188af7..c8422b08e81 100644 --- a/docs/reference/search/suggesters/completion-suggest.asciidoc +++ b/docs/reference/search/suggesters/completion-suggest.asciidoc @@ -28,16 +28,16 @@ which indexes the field values for fast completions. -------------------------------------------------- PUT music { - "mappings": { - "properties" : { - "suggest" : { - "type" : "completion" - }, - "title" : { - "type": "keyword" - } - } + "mappings": { + "properties": { + "suggest": { + "type": "completion" + }, + "title": { + "type": "keyword" + } } + } } -------------------------------------------------- // TESTSETUP @@ -84,10 +84,10 @@ the suggestions will be scored. Indexing a suggestion is as follows: -------------------------------------------------- PUT music/_doc/1?refresh { - "suggest" : { - "input": [ "Nevermind", "Nirvana" ], - "weight" : 34 - } + "suggest" : { + "input": [ "Nevermind", "Nirvana" ], + "weight" : 34 + } } -------------------------------------------------- // TEST @@ -120,16 +120,16 @@ You can index multiple suggestions for a document as follows: -------------------------------------------------- PUT music/_doc/1?refresh { - "suggest" : [ - { - "input": "Nevermind", - "weight" : 10 - }, - { - "input": "Nirvana", - "weight" : 3 - } - ] + "suggest": [ + { + "input": "Nevermind", + "weight": 10 + }, + { + "input": "Nirvana", + "weight": 3 + } + ] } -------------------------------------------------- // TEST[continued] @@ -158,14 +158,14 @@ documents once deleted are never shown. This request: -------------------------------------------------- POST music/_search?pretty { - "suggest": { - "song-suggest" : { - "prefix" : "nir", <1> - "completion" : { <2> - "field" : "suggest" <3> - } - } + "suggest": { + "song-suggest": { + "prefix": "nir", <1> + "completion": { <2> + "field": "suggest" <3> + } } + } } -------------------------------------------------- // TEST[continued] @@ -227,16 +227,16 @@ filtering but using suggest on the `_search` endpoint does: -------------------------------------------------- POST music/_search { - "_source": "suggest", <1> - "suggest": { - "song-suggest" : { - "prefix" : "nir", - "completion" : { - "field" : "suggest", <2> - "size" : 5 <3> - } - } + "_source": "suggest", <1> + "suggest": { + "song-suggest": { + "prefix": "nir", + "completion": { + "field": "suggest", <2> + "size": 5 <3> + } } + } } -------------------------------------------------- // TEST[continued] @@ -250,39 +250,39 @@ Which should look like: [source,console-result] -------------------------------------------------- { - "took": 6, - "timed_out": false, - "_shards" : { - "total" : 1, - "successful" : 1, - "skipped" : 0, - "failed" : 0 + "took": 6, + "timed_out": false, + "_shards": { + "total": 1, + "successful": 1, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": { + "value": 0, + "relation": "eq" }, - "hits": { - "total" : { - "value": 0, - "relation": "eq" - }, - "max_score" : null, - "hits" : [] - }, - "suggest": { - "song-suggest" : [ { - "text" : "nir", - "offset" : 0, - "length" : 3, - "options" : [ { - "text" : "Nirvana", - "_index": "music", - "_type": "_doc", - "_id": "1", - "_score": 1.0, - "_source": { - "suggest": ["Nevermind", "Nirvana"] - } - } ] - } ] - } + "max_score": null, + "hits": [] + }, + "suggest": { + "song-suggest": [ { + "text": "nir", + "offset": 0, + "length": 3, + "options": [ { + "text": "Nirvana", + "_index": "music", + "_type": "_doc", + "_id": "1", + "_score": 1.0, + "_source": { + "suggest": [ "Nevermind", "Nirvana" ] + } + } ] + } ] + } } -------------------------------------------------- // TESTRESPONSE[s/"took": 6,/"took": $body.took,/] @@ -318,15 +318,15 @@ When set, this option filters out documents with duplicate suggestions from the -------------------------------------------------- POST music/_search?pretty { - "suggest": { - "song-suggest" : { - "prefix" : "nor", - "completion" : { - "field" : "suggest", - "skip_duplicates": true - } - } + "suggest": { + "song-suggest": { + "prefix": "nor", + "completion": { + "field": "suggest", + "skip_duplicates": true + } } + } } -------------------------------------------------- @@ -343,17 +343,17 @@ you can have a typo in your search and still get results back. -------------------------------------------------- POST music/_search?pretty { - "suggest": { - "song-suggest" : { - "prefix" : "nor", - "completion" : { - "field" : "suggest", - "fuzzy" : { - "fuzziness" : 2 - } - } + "suggest": { + "song-suggest": { + "prefix": "nor", + "completion": { + "field": "suggest", + "fuzzy": { + "fuzziness": 2 } + } } + } } -------------------------------------------------- @@ -401,14 +401,14 @@ you can express a prefix as a regular expression -------------------------------------------------- POST music/_search?pretty { - "suggest": { - "song-suggest" : { - "regex" : "n[ever|i]r", - "completion" : { - "field" : "suggest" - } - } + "suggest": { + "song-suggest": { + "regex": "n[ever|i]r", + "completion": { + "field": "suggest" + } } + } } -------------------------------------------------- diff --git a/docs/reference/search/suggesters/context-suggest.asciidoc b/docs/reference/search/suggesters/context-suggest.asciidoc index b8f6d2b8b18..0a03da71faf 100644 --- a/docs/reference/search/suggesters/context-suggest.asciidoc +++ b/docs/reference/search/suggesters/context-suggest.asciidoc @@ -23,50 +23,50 @@ field: -------------------------------------------------- PUT place { - "mappings": { - "properties" : { - "suggest" : { - "type" : "completion", - "contexts": [ - { <1> - "name": "place_type", - "type": "category" - }, - { <2> - "name": "location", - "type": "geo", - "precision": 4 - } - ] - } - } + "mappings": { + "properties": { + "suggest": { + "type": "completion", + "contexts": [ + { <1> + "name": "place_type", + "type": "category" + }, + { <2> + "name": "location", + "type": "geo", + "precision": 4 + } + ] + } } + } } PUT place_path_category { - "mappings": { - "properties" : { - "suggest" : { - "type" : "completion", - "contexts": [ - { <3> - "name": "place_type", - "type": "category", - "path": "cat" - }, - { <4> - "name": "location", - "type": "geo", - "precision": 4, - "path": "loc" - } - ] - }, - "loc": { - "type": "geo_point" - } - } + "mappings": { + "properties": { + "suggest": { + "type": "completion", + "contexts": [ + { <3> + "name": "place_type", + "type": "category", + "path": "cat" + }, + { <4> + "name": "location", + "type": "geo", + "precision": 4, + "path": "loc" + } + ] + }, + "loc": { + "type": "geo_point" + } } + } } -------------------------------------------------- // TESTSETUP @@ -98,12 +98,12 @@ be sent in the suggest field like this: -------------------------------------------------- PUT place/_doc/1 { - "suggest": { - "input": ["timmy's", "starbucks", "dunkin donuts"], - "contexts": { - "place_type": ["cafe", "food"] <1> - } + "suggest": { + "input": [ "timmy's", "starbucks", "dunkin donuts" ], + "contexts": { + "place_type": [ "cafe", "food" ] <1> } + } } -------------------------------------------------- @@ -116,8 +116,8 @@ add the categories: -------------------------------------------------- PUT place_path_category/_doc/1 { - "suggest": ["timmy's", "starbucks", "dunkin donuts"], - "cat": ["cafe", "food"] <1> + "suggest": ["timmy's", "starbucks", "dunkin donuts"], + "cat": ["cafe", "food"] <1> } -------------------------------------------------- @@ -138,18 +138,18 @@ filters suggestions by multiple categories: -------------------------------------------------- POST place/_search?pretty { - "suggest": { - "place_suggestion" : { - "prefix" : "tim", - "completion" : { - "field" : "suggest", - "size": 10, - "contexts": { - "place_type": [ "cafe", "restaurants" ] - } - } + "suggest": { + "place_suggestion": { + "prefix": "tim", + "completion": { + "field": "suggest", + "size": 10, + "contexts": { + "place_type": [ "cafe", "restaurants" ] } + } } + } } -------------------------------------------------- // TEST[continued] @@ -166,21 +166,21 @@ suggestions associated with some categories: -------------------------------------------------- POST place/_search?pretty { - "suggest": { - "place_suggestion" : { - "prefix" : "tim", - "completion" : { - "field" : "suggest", - "size": 10, - "contexts": { - "place_type": [ <1> - { "context" : "cafe" }, - { "context" : "restaurants", "boost": 2 } - ] - } - } + "suggest": { + "place_suggestion": { + "prefix": "tim", + "completion": { + "field": "suggest", + "size": 10, + "contexts": { + "place_type": [ <1> + { "context": "cafe" }, + { "context": "restaurants", "boost": 2 } + ] } + } } + } } -------------------------------------------------- // TEST[continued] @@ -251,21 +251,21 @@ with two geo location contexts: -------------------------------------------------- PUT place/_doc/1 { - "suggest": { - "input": "timmy's", - "contexts": { - "location": [ - { - "lat": 43.6624803, - "lon": -79.3863353 - }, - { - "lat": 43.6624718, - "lon": -79.3873227 - } - ] + "suggest": { + "input": "timmy's", + "contexts": { + "location": [ + { + "lat": 43.6624803, + "lon": -79.3863353 + }, + { + "lat": 43.6624718, + "lon": -79.3873227 } + ] } + } } -------------------------------------------------- @@ -280,21 +280,21 @@ the encoded geohash of a geo point: -------------------------------------------------- POST place/_search { - "suggest": { - "place_suggestion" : { - "prefix" : "tim", - "completion" : { - "field" : "suggest", - "size": 10, - "contexts": { - "location": { - "lat": 43.662, - "lon": -79.380 - } - } - } + "suggest": { + "place_suggestion": { + "prefix": "tim", + "completion": { + "field": "suggest", + "size": 10, + "contexts": { + "location": { + "lat": 43.662, + "lon": -79.380 + } } + } } + } } -------------------------------------------------- // TEST[continued] @@ -313,31 +313,31 @@ than others, as shown by the following: -------------------------------------------------- POST place/_search?pretty { - "suggest": { - "place_suggestion" : { - "prefix" : "tim", - "completion" : { - "field" : "suggest", - "size": 10, - "contexts": { - "location": [ <1> - { - "lat": 43.6624803, - "lon": -79.3863353, - "precision": 2 - }, - { - "context": { - "lat": 43.6624803, - "lon": -79.3863353 - }, - "boost": 2 - } - ] - } + "suggest": { + "place_suggestion": { + "prefix": "tim", + "completion": { + "field": "suggest", + "size": 10, + "contexts": { + "location": [ <1> + { + "lat": 43.6624803, + "lon": -79.3863353, + "precision": 2 + }, + { + "context": { + "lat": 43.6624803, + "lon": -79.3863353 + }, + "boost": 2 } + ] } + } } + } } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/searchable-snapshots/apis/clear-cache.asciidoc b/docs/reference/searchable-snapshots/apis/clear-cache.asciidoc index 9081eac4c55..56f48873218 100644 --- a/docs/reference/searchable-snapshots/apis/clear-cache.asciidoc +++ b/docs/reference/searchable-snapshots/apis/clear-cache.asciidoc @@ -45,16 +45,16 @@ searchable snapshots cache must be cleared. ----------------------------------- PUT /docs { - "settings" : { - "index.number_of_shards" : 1, - "index.number_of_replicas" : 0 - } + "settings" : { + "index.number_of_shards" : 1, + "index.number_of_replicas" : 0 + } } PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true { - "include_global_state": false, - "indices": "docs" + "include_global_state": false, + "indices": "docs" } DELETE /docs diff --git a/docs/reference/searchable-snapshots/apis/get-stats.asciidoc b/docs/reference/searchable-snapshots/apis/get-stats.asciidoc index c3b17a5ca1e..5d30d731d17 100644 --- a/docs/reference/searchable-snapshots/apis/get-stats.asciidoc +++ b/docs/reference/searchable-snapshots/apis/get-stats.asciidoc @@ -45,16 +45,16 @@ statistics must be retrieved. ----------------------------------- PUT /docs { - "settings" : { - "index.number_of_shards" : 1, - "index.number_of_replicas" : 0 - } + "settings" : { + "index.number_of_shards" : 1, + "index.number_of_replicas" : 0 + } } PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true { - "include_global_state": false, - "indices": "docs" + "include_global_state": false, + "indices": "docs" } DELETE /docs diff --git a/docs/reference/searchable-snapshots/apis/mount-snapshot.asciidoc b/docs/reference/searchable-snapshots/apis/mount-snapshot.asciidoc index 1b061b28573..0eb6787ff09 100644 --- a/docs/reference/searchable-snapshots/apis/mount-snapshot.asciidoc +++ b/docs/reference/searchable-snapshots/apis/mount-snapshot.asciidoc @@ -86,16 +86,16 @@ Names of settings that should be removed from the index when it is mounted. ----------------------------------- PUT /my_docs { - "settings" : { - "index.number_of_shards" : 1, - "index.number_of_replicas" : 0 - } + "settings" : { + "index.number_of_shards" : 1, + "index.number_of_replicas" : 0 + } } PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true { - "include_global_state": false, - "indices": "my_docs" + "include_global_state": false, + "indices": "my_docs" } DELETE /my_docs diff --git a/docs/reference/searchable-snapshots/apis/repository-stats.asciidoc b/docs/reference/searchable-snapshots/apis/repository-stats.asciidoc index 2818b13fa52..ef54b36108c 100644 --- a/docs/reference/searchable-snapshots/apis/repository-stats.asciidoc +++ b/docs/reference/searchable-snapshots/apis/repository-stats.asciidoc @@ -42,16 +42,16 @@ The repository for which to retrieve stats. ----------------------------------- PUT /docs { - "settings" : { - "index.number_of_shards" : 1, - "index.number_of_replicas" : 0 - } + "settings" : { + "index.number_of_shards" : 1, + "index.number_of_replicas" : 0 + } } PUT /_snapshot/my_repository/my_snapshot?wait_for_completion=true { - "include_global_state": false, - "indices": "docs" + "include_global_state": false, + "indices": "docs" } DELETE /docs diff --git a/docs/reference/snapshot-restore/register-repository.asciidoc b/docs/reference/snapshot-restore/register-repository.asciidoc index 69fa43a6d15..b0140da070e 100644 --- a/docs/reference/snapshot-restore/register-repository.asciidoc +++ b/docs/reference/snapshot-restore/register-repository.asciidoc @@ -124,11 +124,11 @@ the name `my_fs_backup`: ----------------------------------- PUT /_snapshot/my_fs_backup { - "type": "fs", - "settings": { - "location": "/mount/backups/my_fs_backup_location", - "compress": true - } + "type": "fs", + "settings": { + "location": "/mount/backups/my_fs_backup_location", + "compress": true + } } ----------------------------------- // TEST[skip:no access to absolute path] @@ -140,11 +140,11 @@ in `path.repo`: ----------------------------------- PUT /_snapshot/my_fs_backup { - "type": "fs", - "settings": { - "location": "my_fs_backup_location", - "compress": true - } + "type": "fs", + "settings": { + "location": "my_fs_backup_location", + "compress": true + } } ----------------------------------- // TEST[continued] diff --git a/docs/reference/sql/endpoints/rest.asciidoc b/docs/reference/sql/endpoints/rest.asciidoc index 77f6d89ef2a..51e5aaa9fbf 100644 --- a/docs/reference/sql/endpoints/rest.asciidoc +++ b/docs/reference/sql/endpoints/rest.asciidoc @@ -22,7 +22,7 @@ For example: -------------------------------------------------- POST /_sql?format=txt { - "query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5" + "query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5" } -------------------------------------------------- // TEST[setup:library] @@ -114,8 +114,8 @@ Here are some examples for the human readable formats: -------------------------------------------------- POST /_sql?format=csv { - "query": "SELECT * FROM library ORDER BY page_count DESC", - "fetch_size": 5 + "query": "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size": 5 } -------------------------------------------------- // TEST[setup:library] @@ -139,8 +139,8 @@ James S.A. Corey,Leviathan Wakes,561,2011-06-02T00:00:00.000Z -------------------------------------------------- POST /_sql?format=json { - "query": "SELECT * FROM library ORDER BY page_count DESC", - "fetch_size": 5 + "query": "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size": 5 } -------------------------------------------------- // TEST[setup:library] @@ -150,20 +150,20 @@ Which returns: [source,console-result] -------------------------------------------------- { - "columns": [ - {"name": "author", "type": "text"}, - {"name": "name", "type": "text"}, - {"name": "page_count", "type": "short"}, - {"name": "release_date", "type": "datetime"} - ], - "rows": [ - ["Peter F. Hamilton", "Pandora's Star", 768, "2004-03-02T00:00:00.000Z"], - ["Vernor Vinge", "A Fire Upon the Deep", 613, "1992-06-01T00:00:00.000Z"], - ["Frank Herbert", "Dune", 604, "1965-06-01T00:00:00.000Z"], - ["Alastair Reynolds", "Revelation Space", 585, "2000-03-15T00:00:00.000Z"], - ["James S.A. Corey", "Leviathan Wakes", 561, "2011-06-02T00:00:00.000Z"] - ], - "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8=" + "columns": [ + {"name": "author", "type": "text"}, + {"name": "name", "type": "text"}, + {"name": "page_count", "type": "short"}, + {"name": "release_date", "type": "datetime"} + ], + "rows": [ + ["Peter F. Hamilton", "Pandora's Star", 768, "2004-03-02T00:00:00.000Z"], + ["Vernor Vinge", "A Fire Upon the Deep", 613, "1992-06-01T00:00:00.000Z"], + ["Frank Herbert", "Dune", 604, "1965-06-01T00:00:00.000Z"], + ["Alastair Reynolds", "Revelation Space", 585, "2000-03-15T00:00:00.000Z"], + ["James S.A. Corey", "Leviathan Wakes", 561, "2011-06-02T00:00:00.000Z"] + ], + "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8=" } -------------------------------------------------- // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl\+v\/\/\/w8=/$body.cursor/] @@ -174,8 +174,8 @@ Which returns: -------------------------------------------------- POST /_sql?format=tsv { - "query": "SELECT * FROM library ORDER BY page_count DESC", - "fetch_size": 5 + "query": "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size": 5 } -------------------------------------------------- // TEST[setup:library] @@ -200,8 +200,8 @@ James S.A. Corey Leviathan Wakes 561 2011-06-02T00:00:00.000Z -------------------------------------------------- POST /_sql?format=txt { - "query": "SELECT * FROM library ORDER BY page_count DESC", - "fetch_size": 5 + "query": "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size": 5 } -------------------------------------------------- // TEST[setup:library] @@ -227,8 +227,8 @@ James S.A. Corey |Leviathan Wakes |561 |2011-06-02T00:00:00.000Z -------------------------------------------------- POST /_sql?format=yaml { - "query": "SELECT * FROM library ORDER BY page_count DESC", - "fetch_size": 5 + "query": "SELECT * FROM library ORDER BY page_count DESC", + "fetch_size": 5 } -------------------------------------------------- // TEST[setup:library] @@ -282,7 +282,7 @@ format, the cursor is returned as `Cursor` http header. -------------------------------------------------- POST /_sql?format=json { - "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=" + "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=" } -------------------------------------------------- // TEST[continued] @@ -293,14 +293,14 @@ Which looks like: [source,console-result] -------------------------------------------------- { - "rows" : [ - ["Dan Simmons", "Hyperion", 482, "1989-05-26T00:00:00.000Z"], - ["Iain M. Banks", "Consider Phlebas", 471, "1987-04-23T00:00:00.000Z"], - ["Neal Stephenson", "Snow Crash", 470, "1992-06-01T00:00:00.000Z"], - ["Frank Herbert", "God Emperor of Dune", 454, "1981-05-28T00:00:00.000Z"], - ["Frank Herbert", "Children of Dune", 408, "1976-04-21T00:00:00.000Z"] - ], - "cursor" : "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWODRMaXBUaVlRN21iTlRyWHZWYUdrdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl9f///w8=" + "rows" : [ + ["Dan Simmons", "Hyperion", 482, "1989-05-26T00:00:00.000Z"], + ["Iain M. Banks", "Consider Phlebas", 471, "1987-04-23T00:00:00.000Z"], + ["Neal Stephenson", "Snow Crash", 470, "1992-06-01T00:00:00.000Z"], + ["Frank Herbert", "God Emperor of Dune", 454, "1981-05-28T00:00:00.000Z"], + ["Frank Herbert", "Children of Dune", 408, "1976-04-21T00:00:00.000Z"] + ], + "cursor" : "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWODRMaXBUaVlRN21iTlRyWHZWYUdrdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl9f///w8=" } -------------------------------------------------- // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWODRMaXBUaVlRN21iTlRyWHZWYUdrdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl9f\/\/\/w8=/$body.cursor/] @@ -319,7 +319,7 @@ To clear the state earlier, you can use the clear cursor command: -------------------------------------------------- POST /_sql/close { - "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=" + "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8=" } -------------------------------------------------- // TEST[continued] @@ -330,7 +330,7 @@ Which will like return the [source,console-result] -------------------------------------------------- { - "succeeded" : true + "succeeded" : true } -------------------------------------------------- @@ -346,16 +346,16 @@ parameter. -------------------------------------------------- POST /_sql?format=txt { - "query": "SELECT * FROM library ORDER BY page_count DESC", - "filter": { - "range": { - "page_count": { - "gte" : 100, - "lte" : 200 - } - } - }, - "fetch_size": 5 + "query": "SELECT * FROM library ORDER BY page_count DESC", + "filter": { + "range": { + "page_count": { + "gte" : 100, + "lte" : 200 + } + } + }, + "fetch_size": 5 } -------------------------------------------------- // TEST[setup:library] @@ -380,12 +380,12 @@ Because {es-sql} does not support a `routing` parameter, one can specify a <> right away: -------------------------------------------------- POST /_sql?format=txt { - "query": "SELECT * FROM library WHERE release_date < '2000-01-01'" + "query": "SELECT * FROM library WHERE release_date < '2000-01-01'" } -------------------------------------------------- // TEST[continued] diff --git a/docs/reference/sql/language/data-types.asciidoc b/docs/reference/sql/language/data-types.asciidoc index 2c799dc7276..6dc67161cdd 100644 --- a/docs/reference/sql/language/data-types.asciidoc +++ b/docs/reference/sql/language/data-types.asciidoc @@ -107,14 +107,14 @@ Consider the following `string` mapping: [source,js] ---- { - "first_name" : { - "type" : "text", - "fields" : { - "raw" : { - "type" : "keyword" - } - } + "first_name": { + "type": "text", + "fields": { + "raw": { + "type": "keyword" + } } + } } ---- // NOTCONSOLE diff --git a/x-pack/docs/en/rest-api/security/get-tokens.asciidoc b/x-pack/docs/en/rest-api/security/get-tokens.asciidoc index c4b7c734a06..196156639bd 100644 --- a/x-pack/docs/en/rest-api/security/get-tokens.asciidoc +++ b/x-pack/docs/en/rest-api/security/get-tokens.asciidoc @@ -176,8 +176,8 @@ creation. For example: -------------------------------------------------- POST /_security/oauth2/token { - "grant_type": "refresh_token", - "refresh_token": "vLBPvmAB6KvwvJZr27cS" + "grant_type": "refresh_token", + "refresh_token": "vLBPvmAB6KvwvJZr27cS" } -------------------------------------------------- // TEST[s/vLBPvmAB6KvwvJZr27cS/$body.refresh_token/] diff --git a/x-pack/docs/en/security/authorization/alias-privileges.asciidoc b/x-pack/docs/en/security/authorization/alias-privileges.asciidoc index be91f9282ae..4b46d0650d3 100644 --- a/x-pack/docs/en/security/authorization/alias-privileges.asciidoc +++ b/x-pack/docs/en/security/authorization/alias-privileges.asciidoc @@ -153,9 +153,9 @@ added to an index directly as part of the index creation: ------------------------------------------------------------------------------- PUT /2015 { - "aliases" : { - "current_year" : {} - } + "aliases": { + "current_year": {} + } } ------------------------------------------------------------------------------- @@ -165,9 +165,9 @@ or via the dedicated aliases api if the index already exists: ------------------------------------------------------------------------------- POST /_aliases { - "actions" : [ - { "add" : { "index" : "2015", "alias" : "current_year" } } - ] + "actions" : [ + { "add" : { "index" : "2015", "alias" : "current_year" } } + ] } ------------------------------------------------------------------------------- // TEST[s/^/PUT 2015\n/] diff --git a/x-pack/docs/en/security/using-ip-filtering.asciidoc b/x-pack/docs/en/security/using-ip-filtering.asciidoc index 2041b1ace4c..9da76c3bded 100644 --- a/x-pack/docs/en/security/using-ip-filtering.asciidoc +++ b/x-pack/docs/en/security/using-ip-filtering.asciidoc @@ -118,9 +118,9 @@ you can use the _Cluster Update Settings API_. For example: -------------------------------------------------- PUT /_cluster/settings { - "persistent" : { - "xpack.security.transport.filter.allow" : "172.16.0.0/24" - } + "persistent" : { + "xpack.security.transport.filter.allow" : "172.16.0.0/24" + } } -------------------------------------------------- @@ -130,9 +130,9 @@ You can also dynamically disable filtering completely: -------------------------------------------------- PUT /_cluster/settings { - "persistent" : { - "xpack.security.transport.filter.enabled" : false - } + "persistent" : { + "xpack.security.transport.filter.enabled" : false + } } -------------------------------------------------- // TEST[continued] diff --git a/x-pack/docs/en/watcher/getting-started.asciidoc b/x-pack/docs/en/watcher/getting-started.asciidoc index 4116cd6f47c..7622ac95719 100644 --- a/x-pack/docs/en/watcher/getting-started.asciidoc +++ b/x-pack/docs/en/watcher/getting-started.asciidoc @@ -119,10 +119,10 @@ adds a 404 error to the `logs` index: -------------------------------------------------- POST logs/event { - "timestamp" : "2015-05-17T18:12:07.613Z", - "request" : "GET index.html", - "status_code" : 404, - "message" : "Error: File not found" + "timestamp": "2015-05-17T18:12:07.613Z", + "request": "GET index.html", + "status_code": 404, + "message": "Error: File not found" } -------------------------------------------------- // TEST[continued]