CONSOLE is the new AUTOSENSE
This commit is contained in:
parent
e486560ea8
commit
a865090cf3
|
@ -7,24 +7,26 @@ of `1.0`.
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
GET /_search
|
GET /_search
|
||||||
{ "query": {
|
{
|
||||||
|
"query": {
|
||||||
"match_all": {}
|
"match_all": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
The `_score` can be changed with the `boost` parameter:
|
The `_score` can be changed with the `boost` parameter:
|
||||||
|
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
GET /_search
|
GET /_search
|
||||||
{ "query": {
|
{
|
||||||
|
"query": {
|
||||||
"match_all": { "boost" : 1.2 }
|
"match_all": { "boost" : 1.2 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
[[query-dsl-match-none-query]]
|
[[query-dsl-match-none-query]]
|
||||||
[float]
|
[float]
|
||||||
|
@ -35,9 +37,10 @@ This is the inverse of the `match_all` query, which matches no documents.
|
||||||
[source,js]
|
[source,js]
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
GET /_search
|
GET /_search
|
||||||
{ "query": {
|
{
|
||||||
|
"query": {
|
||||||
"match_none": {}
|
"match_none": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
|
@ -27,7 +27,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
A more complicated use case consists of mixing texts with documents already
|
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
|
existing in the index. In this case, the syntax to specify a document is
|
||||||
|
@ -59,7 +59,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
Finally, users can mix some texts, a chosen set of documents but also provide
|
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
|
documents not necessarily present in the index. To provide documents not
|
||||||
|
@ -96,7 +96,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
==== How it Works
|
==== How it Works
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ PUT /imdb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
==== Parameters
|
==== Parameters
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
<1> The query string.
|
<1> The query string.
|
||||||
<2> The fields to be queried.
|
<2> The fields to be queried.
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
<1> Query the `title`, `first_name` and `last_name` fields.
|
<1> Query the `title`, `first_name` and `last_name` fields.
|
||||||
|
|
||||||
Individual fields can be boosted with the caret (`^`) notation:
|
Individual fields can be boosted with the caret (`^`) notation:
|
||||||
|
@ -54,7 +54,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
<1> The `subject` field is three times as important as the `message` field.
|
<1> The `subject` field is three times as important as the `message` field.
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
would be executed as:
|
would be executed as:
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
Normally the `best_fields` type uses the score of the *single* best matching
|
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
|
field, but if `tie_breaker` is specified, then it calculates the score as
|
||||||
|
@ -165,7 +165,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
<1> All terms must be present.
|
<1> All terms must be present.
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
would be executed as:
|
would be executed as:
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
The score from each `match` clause is added together, then divided by the
|
The score from each `match` clause is added together, then divided by the
|
||||||
number of `match` clauses.
|
number of `match` clauses.
|
||||||
|
@ -257,7 +257,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
would be executed as:
|
would be executed as:
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
Also, accepts `analyzer`, `boost`, `slop` and `zero_terms_query` as explained
|
Also, accepts `analyzer`, `boost`, `slop` and `zero_terms_query` as explained
|
||||||
in <<query-dsl-match-query>>. Type `phrase_prefix` additionally accepts
|
in <<query-dsl-match-query>>. Type `phrase_prefix` additionally accepts
|
||||||
|
@ -335,7 +335,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
is executed as:
|
is executed as:
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
would be executed as:
|
would be executed as:
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
<1> Either `will` or `smith` must be present in either of the `first`
|
<1> Either `will` or `smith` must be present in either of the `first`
|
||||||
or `last` fields
|
or `last` fields
|
||||||
|
@ -469,7 +469,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
<1> Use the `standard` analyzer for all fields.
|
<1> Use the `standard` analyzer for all fields.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
A boost can also be associated with the query:
|
A boost can also be associated with the query:
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
Or :
|
Or :
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
This multi term query allows you to control how it gets rewritten using the
|
This multi term query allows you to control how it gets rewritten using the
|
||||||
<<query-dsl-multi-term-rewrite,rewrite>>
|
<<query-dsl-multi-term-rewrite,rewrite>>
|
||||||
|
|
|
@ -63,7 +63,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
------------------------------------
|
------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
<1> The `query` parameter indicates query context.
|
<1> The `query` parameter indicates query context.
|
||||||
<2> The `bool` and two `match` clauses are used in 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
|
which means that they are used to score how well each document
|
||||||
|
|
|
@ -22,7 +22,7 @@ GET _search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
The `range` query accepts the following parameters:
|
The `range` query accepts the following parameters:
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ GET _search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
===== Date math and rounding
|
===== Date math and rounding
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ GET _search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
// CONSOLE
|
||||||
|
|
||||||
===== Time zone in range queries
|
===== Time zone in range queries
|
||||||
|
|
||||||
|
@ -117,8 +118,7 @@ accepts it), or it can be specified as the `time_zone` parameter:
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
GET _search
|
GET _search
|
||||||
{
|
{
|
||||||
"query":
|
"query": {
|
||||||
{
|
|
||||||
"range" : {
|
"range" : {
|
||||||
"timestamp" : {
|
"timestamp" : {
|
||||||
"gte": "2015-01-01 00:00:00", <1>
|
"gte": "2015-01-01 00:00:00", <1>
|
||||||
|
@ -129,6 +129,6 @@ GET _search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
<1> This date will be converted to `2014-12-31T23:00:00 UTC`.
|
<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).
|
<2> `now` is not affected by the `time_zone` parameter (dates must be stored as UTC).
|
||||||
|
|
|
@ -18,7 +18,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
The `match` clause can be any other span type query. The `end` controls
|
The `match` clause can be any other span type query. The `end` controls
|
||||||
the maximum end position permitted in a match.
|
the maximum end position permitted in a match.
|
||||||
|
|
|
@ -20,7 +20,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
The above request is translated into:
|
The above request is translated into:
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
Alternatively passing the template as an escaped string works as well:
|
Alternatively passing the template as an escaped string works as well:
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
<1> New line characters (`\n`) should be escaped as `\\n` or removed,
|
<1> New line characters (`\n`) should be escaped as `\\n` or removed,
|
||||||
and quotes (`"`) should be escaped as `\\"`.
|
and quotes (`"`) should be escaped as `\\"`.
|
||||||
|
@ -79,7 +79,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
<1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`.
|
<1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`.
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ PUT /_search/template/my_template
|
||||||
"template": { "match": { "text": "{{query_string}}" }}
|
"template": { "match": { "text": "{{query_string}}" }}
|
||||||
}
|
}
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
||||||
and refer to it in the `template` query with the `id` parameter:
|
and refer to it in the `template` query with the `id` parameter:
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
// TEST[continued]
|
// TEST[continued]
|
||||||
|
|
||||||
<1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`.
|
<1> Name of the query template in `config/scripts/`, i.e., `my_template.mustache`.
|
||||||
|
|
|
@ -14,4 +14,4 @@ GET /_search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
// AUTOSENSE
|
// CONSOLE
|
||||||
|
|
Loading…
Reference in New Issue