Browse Source

Add Autosense annotation for query dsl testing

this adds the autosense annotation to a couple of query dsl
docs files and fixes the snippets to work in the tests along
the way.
Isabel Drost-Fromm 9 years ago
parent
commit
e486560ea8

+ 3 - 3
docs/reference/query-dsl/bool-query.asciidoc

@@ -81,7 +81,7 @@ all documents where the `status` field contains the term `active`.
 This first query assigns a score of `0` to all documents, as no scoring
 query has been specified:
 
-[source,json]
+[source,js]
 ---------------------------------
 GET _search
 {
@@ -101,7 +101,7 @@ GET _search
 This `bool` query has a `match_all` query, which assigns a score of `1.0` to
 all documents.
 
-[source,json]
+[source,js]
 ---------------------------------
 GET _search
 {
@@ -125,7 +125,7 @@ This `constant_score` query behaves in exactly the same way as the second exampl
 The `constant_score` query assigns a score of `1.0` to all documents matched
 by the filter.
 
-[source,json]
+[source,js]
 ---------------------------------
 GET _search
 {

+ 4 - 0
docs/reference/query-dsl/constant-score-query.asciidoc

@@ -7,12 +7,16 @@ filter. Maps to Lucene `ConstantScoreQuery`.
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "constant_score" : {
         "filter" : {
             "term" : { "user" : "kimchy"}
         },
         "boost" : 1.2
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE

+ 40 - 28
docs/reference/query-dsl/function-score-query.asciidoc

@@ -14,13 +14,20 @@ by the query.
 
 [source,js]
 --------------------------------------------------
-"function_score": {
-    "query": {},
-    "boost": "boost for the whole query",
-    "FUNCTION": {}, <1>
-    "boost_mode":"(multiply|replace|...)"
+GET /_search
+{
+  "query": {
+    "function_score": {
+        "query": {},
+        "boost": "5",
+        "random_score": {}, <1>
+        "boost_mode":"multiply"
+    }
+  }
 }
 --------------------------------------------------
+// CONSOLE
+
 <1> See <<score-functions>> for a list of supported functions.
 
 Furthermore, several functions can be combined. In this case one can
@@ -29,30 +36,35 @@ given filtering query
 
 [source,js]
 --------------------------------------------------
-"function_score": {
-    "query": {},
-    "boost": "boost for the whole query",
-    "functions": [
-        {
-            "filter": {},
-            "FUNCTION": {}, <1>
-            "weight": number
-        },
-        {
-            "FUNCTION": {} <1>
-        },
-        {
-            "filter": {},
-            "weight": number
-        }
-    ],
-    "max_boost": number,
-    "score_mode": "(multiply|max|...)",
-    "boost_mode": "(multiply|replace|...)",
-    "min_score" : number
+GET /_search
+{
+  "query": {
+    "function_score": {
+      "query": {},
+      "boost": "5", <1>
+      "functions": [
+          {
+              "filter": {},
+              "random_score": {}, <2>
+              "weight": 23
+          },
+          {
+              "filter": {},
+              "weight": 42 
+          }
+      ],
+      "max_boost": 42,
+      "score_mode": "max",
+      "boost_mode": "multiply",
+      "min_score" : 42
+    }
+  }
 }
 --------------------------------------------------
-<1> See <<score-functions>> for a list of supported functions.
+// CONSOLE
+
+<1> Boost for the whole query.
+<2> See <<score-functions>> for a list of supported functions.
 
 NOTE: The scores produced by the filtering query of each function do not matter.
 
@@ -459,7 +471,7 @@ the request would look like this:
 
 [source,js]
 --------------------------------------------------
-GET _search
+GET /_search
 {
   "query": {
     "function_score": {

+ 55 - 1
docs/reference/query-dsl/geo-distance-query.asciidoc

@@ -2,10 +2,35 @@
 === Geo Distance Query
 
 Filters documents that include only hits that exists within a specific
-distance from a geo point. Assuming the following indexed json:
+distance from a geo point. Assuming the following mapping:
 
 [source,js]
 --------------------------------------------------
+PUT /my_locations
+{
+  "mappings": {
+        "location": {
+            "properties": {
+                "pin": {
+                    "properties": {
+                        "location": {
+                            "type": "geo_point"
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+--------------------------------------------------
+// CONSOLE
+
+... and indexed document:
+
+
+[source,js]
+--------------------------------------------------
+PUT /my_locations/location/1
 {
     "pin" : {
         "location" : {
@@ -15,13 +40,18 @@ distance from a geo point. Assuming the following indexed json:
     }
 }
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]
+
 
 Then the following simple query can be executed with a `geo_distance`
 filter:
 
 [source,js]
 --------------------------------------------------
+GET /my_locations/location/_search
 {
+  "query": {
     "bool" : {
         "must" : {
             "match_all" : {}
@@ -36,8 +66,11 @@ filter:
             }
         }
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]
 
 [float]
 ==== Accepted Formats
@@ -50,7 +83,9 @@ representation of the geo point, the filter can accept it as well:
 
 [source,js]
 --------------------------------------------------
+GET /my_locations/location/_search
 {
+  "query": {
     "bool" : {
         "must" : {
             "match_all" : {}
@@ -65,8 +100,11 @@ representation of the geo point, the filter can accept it as well:
             }
         }
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]
 
 [float]
 ===== Lat Lon As Array
@@ -76,7 +114,9 @@ conform with http://geojson.org/[GeoJSON].
 
 [source,js]
 --------------------------------------------------
+GET /my_locations/location/_search
 {
+  "query": {
     "bool" : {
         "must" : {
             "match_all" : {}
@@ -88,8 +128,12 @@ conform with http://geojson.org/[GeoJSON].
             }
         }
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]
+
 
 [float]
 ===== Lat Lon As String
@@ -98,7 +142,9 @@ Format in `lat,lon`.
 
 [source,js]
 --------------------------------------------------
+GET /my_locations/location/_search
 {
+  "query": {
     "bool" : {
         "must" : {
             "match_all" : {}
@@ -110,15 +156,20 @@ Format in `lat,lon`.
             }
         }
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]
 
 [float]
 ===== Geohash
 
 [source,js]
 --------------------------------------------------
+GET /my_locations/location/_search
 {
+  "query": {
     "bool" : {
         "must" : {
             "match_all" : {}
@@ -130,8 +181,11 @@ Format in `lat,lon`.
             }
         }
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
+// TEST[continued]
 
 [float]
 ==== Options

+ 18 - 3
docs/reference/query-dsl/match-all-query.asciidoc

@@ -6,15 +6,25 @@ of `1.0`.
 
 [source,js]
 --------------------------------------------------
-{ "match_all": {} }
+GET /_search
+{ "query": {
+    "match_all": {}
+  }
+}
 --------------------------------------------------
+// AUTOSENSE
 
 The `_score` can be changed with the `boost` parameter:
 
 [source,js]
 --------------------------------------------------
-{ "match_all": { "boost" : 1.2 }}
+GET /_search
+{ "query": {
+    "match_all": { "boost" : 1.2 }
+  }
+}
 --------------------------------------------------
+// AUTOSENSE
 
 [[query-dsl-match-none-query]]
 [float]
@@ -24,5 +34,10 @@ This is the inverse of the `match_all` query, which matches no documents.
 
 [source,js]
 --------------------------------------------------
-{ "match_none": {} }
+GET /_search
+{ "query": {
+    "match_none": {} 
+  }
+}
 --------------------------------------------------
+// AUTOSENSE

+ 15 - 1
docs/reference/query-dsl/mlt-query.asciidoc

@@ -15,15 +15,19 @@ fields, limiting the number of selected terms to 12.
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "more_like_this" : {
         "fields" : ["title", "description"],
         "like" : "Once upon a time",
         "min_term_freq" : 1,
         "max_query_terms" : 12
     }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 A more complicated use case consists of mixing texts with documents already
 existing in the index. In this case, the syntax to specify a document is
@@ -31,7 +35,9 @@ similar to the one used in the <<docs-multi-get,Multi GET API>>.
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "more_like_this" : {
         "fields" : ["title", "description"],
         "like" : [
@@ -50,8 +56,10 @@ similar to the one used in the <<docs-multi-get,Multi GET API>>.
         "min_term_freq" : 1,
         "max_query_terms" : 12
     }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 Finally, users can mix some texts, a chosen set of documents but also provide
 documents not necessarily present in the index. To provide documents not
@@ -59,7 +67,9 @@ present in the index, the syntax is similar to <<docs-termvectors-artificial-doc
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "more_like_this" : {
         "fields" : ["name.first", "name.last"],
         "like" : [
@@ -83,8 +93,10 @@ present in the index, the syntax is similar to <<docs-termvectors-artificial-doc
         "min_term_freq" : 1,
         "max_query_terms" : 12
     }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 ==== How it Works
 
@@ -111,7 +123,8 @@ default, but there will be no speed up on analysis for these fields.
 
 [source,js]
 --------------------------------------------------
-curl -s -XPUT 'http://localhost:9200/imdb/' -d '{
+PUT /imdb
+{
   "mappings": {
     "movies": {
       "properties": {
@@ -137,6 +150,7 @@ curl -s -XPUT 'http://localhost:9200/imdb/' -d '{
   }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 ==== Parameters
 

+ 90 - 30
docs/reference/query-dsl/multi-match-query.asciidoc

@@ -6,13 +6,17 @@ to allow multi-field queries:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "multi_match" : {
-    "query":    "this is a test", <1>
-    "fields": [ "subject", "message" ] <2>
+  "query": {
+    "multi_match" : {
+      "query":    "this is a test", <1>
+      "fields": [ "subject", "message" ] <2>
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
 <1> The query string.
 <2> The fields to be queried.
 
@@ -23,26 +27,35 @@ Fields can be specified with wildcards, eg:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "multi_match" : {
-    "query":    "Will Smith",
-    "fields": [ "title", "*_name" ] <1>
+  "query": {
+    "multi_match" : {
+      "query":    "Will Smith",
+      "fields": [ "title", "*_name" ] <1>
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
 <1> Query the `title`, `first_name` and `last_name` fields.
 
 Individual fields can be boosted with the caret (`^`) notation:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "multi_match" : {
-    "query" : "this is a test",
-    "fields" : [ "subject^3", "message" ] <1>
+  "query": {
+    "multi_match" : {
+      "query" : "this is a test",
+      "fields" : [ "subject^3", "message" ] <1>
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
+
 <1> The `subject` field is three times as important as the `message` field.
 
 [[multi-match-types]]
@@ -82,30 +95,38 @@ find the single best matching field.  For instance, this query:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
   "multi_match" : {
     "query":      "brown fox",
     "type":       "best_fields",
     "fields":     [ "subject", "message" ],
     "tie_breaker": 0.3
   }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 would be executed as:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "dis_max": {
-    "queries": [
-      { "match": { "subject": "brown fox" }},
-      { "match": { "message": "brown fox" }}
-    ],
-    "tie_breaker": 0.3
+  "query": {
+    "dis_max": {
+      "queries": [
+        { "match": { "subject": "brown fox" }},
+        { "match": { "message": "brown fox" }}
+      ],
+      "tie_breaker": 0.3
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 Normally the `best_fields` type uses the score of the *single* best matching
 field, but if `tie_breaker` is specified, then it calculates the score as
@@ -132,15 +153,20 @@ Take this query for example:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "multi_match" : {
-    "query":      "Will Smith",
-    "type":       "best_fields",
-    "fields":     [ "first_name", "last_name" ],
-    "operator":   "and" <1>
+  "query": {
+    "multi_match" : {
+      "query":      "Will Smith",
+      "type":       "best_fields",
+      "fields":     [ "first_name", "last_name" ],
+      "operator":   "and" <1>
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
+
 <1> All terms must be present.
 
 This query is executed as:
@@ -170,29 +196,37 @@ This query:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "multi_match" : {
-    "query":      "quick brown fox",
-    "type":       "most_fields",
-    "fields":     [ "title", "title.original", "title.shingles" ]
+  "query": {
+    "multi_match" : {
+      "query":      "quick brown fox",
+      "type":       "most_fields",
+      "fields":     [ "title", "title.original", "title.shingles" ]
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 would be executed as:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
-  "bool": {
-    "should": [
-      { "match": { "title":          "quick brown fox" }},
-      { "match": { "title.original": "quick brown fox" }},
-      { "match": { "title.shingles": "quick brown fox" }}
-    ]
+  "query": {
+    "bool": {
+      "should": [
+        { "match": { "title":          "quick brown fox" }},
+        { "match": { "title.original": "quick brown fox" }},
+        { "match": { "title.shingles": "quick brown fox" }}
+      ]
+    }
   }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 The score from each `match` clause is added together, then divided by the
 number of `match` clauses.
@@ -212,28 +246,36 @@ but they use a `match_phrase` or `match_phrase_prefix` query instead of a
 This query:
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
   "multi_match" : {
     "query":      "quick brown f",
     "type":       "phrase_prefix",
     "fields":     [ "subject", "message" ]
   }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 would be executed as:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
   "dis_max": {
     "queries": [
       { "match_phrase_prefix": { "subject": "quick brown f" }},
       { "match_phrase_prefix": { "message": "quick brown f" }}
     ]
   }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 Also, accepts `analyzer`, `boost`, `slop` and `zero_terms_query`  as explained
 in <<query-dsl-match-query>>.  Type `phrase_prefix` additionally accepts
@@ -281,15 +323,19 @@ A query like:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
   "multi_match" : {
     "query":      "Will Smith",
     "type":       "cross_fields",
     "fields":     [ "first_name", "last_name" ],
     "operator":   "and"
   }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 is executed as:
 
@@ -337,7 +383,9 @@ both use an `edge_ngram` analyzer, this query:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
   "multi_match" : {
     "query":      "Jon",
     "type":       "cross_fields",
@@ -346,8 +394,10 @@ both use an `edge_ngram` analyzer, this query:
         "last",  "last.edge"
     ]
   }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 would be executed as:
 
@@ -372,7 +422,9 @@ parameter to just one of them:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "bool": {
         "should": [
             {
@@ -392,8 +444,11 @@ parameter to just one of them:
             }
         ]
     }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE 
+
 <1> Either `will` or `smith` must be present in either of the `first`
     or `last` fields
 
@@ -402,15 +457,20 @@ parameter in the query.
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
   "multi_match" : {
     "query":      "Jon",
     "type":       "cross_fields",
     "analyzer":   "standard", <1>
     "fields":     [ "first", "last", "*.edge" ]
   }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
+
 <1> Use the `standard` analyzer for all fields.
 
 which will be executed as:

+ 12 - 3
docs/reference/query-dsl/prefix-query.asciidoc

@@ -8,28 +8,37 @@ that starts with `ki`:
 
 [source,js]
 --------------------------------------------------
-{
+GET /_search
+{ "query": {
     "prefix" : { "user" : "ki" }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 A boost can also be associated with the query:
 
 [source,js]
 --------------------------------------------------
-{
+GET /_search
+{ "query": {
     "prefix" : { "user" :  { "value" : "ki", "boost" : 2.0 } }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 Or :
 
 [source,js]
 --------------------------------------------------
-{
+GET /_search
+{ "query": {
     "prefix" : { "user" :  { "prefix" : "ki", "boost" : 2.0 } }
+  }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 This multi term query allows you to control how it gets rewritten using the
 <<query-dsl-multi-term-rewrite,rewrite>>

+ 2 - 1
docs/reference/query-dsl/query_filter_context.asciidoc

@@ -47,7 +47,7 @@ conditions are met:
 
 [source,js]
 ------------------------------------
-GET _search
+GET /_search
 {
   "query": { <1>
     "bool": { <2>
@@ -63,6 +63,7 @@ GET _search
   }
 }
 ------------------------------------
+// AUTOSENSE
 <1> The `query` parameter indicates query context.
 <2> The `bool` and two `match` clauses are used in query context,
     which means that they are used to score how well each document

+ 29 - 14
docs/reference/query-dsl/range-query.asciidoc

@@ -9,16 +9,20 @@ a `NumericRangeQuery`. The following example returns all documents where
 
 [source,js]
 --------------------------------------------------
+GET _search
 {
-    "range" : {
-        "age" : {
-            "gte" : 10,
-            "lte" : 20,
-            "boost" : 2.0
+    "query": {
+        "range" : {
+            "age" : {
+                "gte" : 10,
+                "lte" : 20,
+                "boost" : 2.0
+            }
         }
     }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 The `range` query accepts the following parameters:
 
@@ -38,15 +42,19 @@ specified using <<date-math>>:
 
 [source,js]
 --------------------------------------------------
+GET _search
 {
-    "range" : {
-        "date" : {
-            "gte" : "now-1d/d",
-            "lt" :  "now/d"
+    "query": {
+        "range" : {
+            "date" : {
+                "gte" : "now-1d/d",
+                "lt" :  "now/d"
+            }
         }
     }
 }
 --------------------------------------------------
+// AUTOSENSE
 
 ===== Date math and rounding
 
@@ -86,7 +94,9 @@ passing the `format` parameter to the `range` query:
 
 [source,js]
 --------------------------------------------------
+GET _search
 {
+    "query": 
     "range" : {
         "born" : {
             "gte": "01/01/2012",
@@ -105,15 +115,20 @@ accepts it), or it can be specified as the `time_zone` parameter:
 
 [source,js]
 --------------------------------------------------
+GET _search
 {
-    "range" : {
-        "timestamp" : {
-            "gte": "2015-01-01 00:00:00", <1>
-            "lte": "now", <2>
-            "time_zone": "+01:00"
+    "query":
+    {
+        "range" : {
+            "timestamp" : {
+                "gte": "2015-01-01 00:00:00", <1>
+                "lte": "now", <2>
+                "time_zone": "+01:00"
+            }
         }
     }
 }
 --------------------------------------------------
+// AUTOSENSE
 <1> This date will be converted to `2014-12-31T23:00:00 UTC`.
 <2> `now` is not affected by the `time_zone` parameter (dates must be stored as UTC).

+ 12 - 0
docs/reference/query-dsl/simple-query-string-query.asciidoc

@@ -8,15 +8,19 @@ an example:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "simple_query_string" : {
         "query": "\"fried eggs\" +(eggplant | potato) -frittata",
         "analyzer": "snowball",
         "fields": ["body^5","_all"],
         "default_operator": "and"
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
 
 The `simple_query_string` top level parameters include:
 
@@ -94,13 +98,17 @@ introduced fields included). For example:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "simple_query_string" : {
         "fields" : ["content", "name.*^5"],
         "query" : "foo bar baz"
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
 
 [float]
 ==== Flags
@@ -110,13 +118,17 @@ should be enabled. It is specified as a `|`-delimited string with the
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "simple_query_string" : {
         "query" : "foo | bar + baz*",
         "flags" : "OR|AND|PREFIX"
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
 
 The available flags are: `ALL`, `NONE`, `AND`, `OR`, `NOT`, `PREFIX`, `PHRASE`,
 `PRECEDENCE`, `ESCAPE`, `WHITESPACE`, `FUZZY`, `NEAR`, and `SLOP`.

+ 4 - 0
docs/reference/query-dsl/span-first-query.asciidoc

@@ -6,15 +6,19 @@ to Lucene `SpanFirstQuery`. Here is an example:
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "span_first" : {
         "match" : {
             "span_term" : { "user" : "kimchy" }
         },
         "end" : 3
     }
+  }
 }    
 --------------------------------------------------
+// AUTOSENSE
 
 The `match` clause can be any other span type query. The `end` controls
 the maximum end position permitted in a match.

+ 4 - 0
docs/reference/query-dsl/span-or-query.asciidoc

@@ -6,7 +6,9 @@ Matches the union of its span clauses. The span or query maps to Lucene
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "span_or" : {
         "clauses" : [
             { "span_term" : { "field" : "value1" } },
@@ -14,7 +16,9 @@ Matches the union of its span clauses. The span or query maps to Lucene
             { "span_term" : { "field" : "value3" } }
         ]
     }
+  }
 }
 --------------------------------------------------
+// CONSOLE
 
 The `clauses` element is a list of one or more other span type queries.

+ 12 - 3
docs/reference/query-dsl/template-query.asciidoc

@@ -19,8 +19,8 @@ GET /_search
         }
     }
 }
-
 ------------------------------------------
+// AUTOSENSE
 
 The above request is translated into:
 
@@ -34,8 +34,8 @@ GET /_search
         }
     }
 }
-
 ------------------------------------------
+// AUTOSENSE
 
 Alternatively passing the template as an escaped string works as well:
 
@@ -53,6 +53,8 @@ GET /_search
     }
 }
 ------------------------------------------
+// AUTOSENSE
+
 <1> New line characters (`\n`) should be escaped as `\\n` or removed,
     and quotes (`"`) should be escaped as `\\"`.
 
@@ -77,6 +79,8 @@ GET /_search
     }
 }
 ------------------------------------------
+// AUTOSENSE
+
 <1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`.
 
 Alternatively, you can register a query template in the cluster state with:
@@ -85,9 +89,10 @@ Alternatively, you can register a query template in the cluster state with:
 ------------------------------------------
 PUT /_search/template/my_template
 {
-    "template": { "match": { "text": "{{query_string}}" }},
+    "template": { "match": { "text": "{{query_string}}" }}
 }
 ------------------------------------------
+// AUTOSENSE
 
 and refer to it in the `template` query with the `id` parameter:
 
@@ -106,9 +111,13 @@ GET /_search
     }
 }
 ------------------------------------------
+// AUTOSENSE
+// TEST[continued]
+
 <1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`.
 
 
 There is also a dedicated `template` endpoint, allows you to template an entire search request.
 Please see <<search-template>> for more details.
 
+

+ 4 - 0
docs/reference/query-dsl/type-query.asciidoc

@@ -5,9 +5,13 @@ Filters documents matching the provided document / mapping type.
 
 [source,js]
 --------------------------------------------------
+GET /_search
 {
+  "query": {
     "type" : {
         "value" : "my_type"
     }
+  }
 }    
 --------------------------------------------------
+// AUTOSENSE