parent
754a677ff5
commit
ab4367c07e
|
@ -96,12 +96,13 @@ passing the `format` parameter to the `range` query:
|
|||
--------------------------------------------------
|
||||
GET _search
|
||||
{
|
||||
"query":
|
||||
"range" : {
|
||||
"born" : {
|
||||
"gte": "01/01/2012",
|
||||
"lte": "2013",
|
||||
"format": "dd/MM/yyyy||yyyy"
|
||||
"query": {
|
||||
"range" : {
|
||||
"born" : {
|
||||
"gte": "01/01/2012",
|
||||
"lte": "2013",
|
||||
"format": "dd/MM/yyyy||yyyy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,24 +6,28 @@ query maps to Lucene `SpanContainingQuery`. Here is an example:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The `big` and `little` clauses can be any span type query. Matching
|
||||
spans from `big` that contain matches from `little` are returned.
|
||||
|
|
|
@ -7,24 +7,32 @@ it can be nested. Example:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"span_multi":{
|
||||
"match":{
|
||||
"prefix" : { "user" : { "value" : "ki" } }
|
||||
"query": {
|
||||
"span_multi":{
|
||||
"match":{
|
||||
"prefix" : { "user" : { "value" : "ki" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
A boost can also be associated with the query:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"span_multi":{
|
||||
"match":{
|
||||
"prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } }
|
||||
"query": {
|
||||
"span_multi":{
|
||||
"match":{
|
||||
"prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
|
|
@ -8,18 +8,22 @@ matches are required to be in-order. The span near query maps to Lucene
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The `clauses` element is a list of one or more other span type queries
|
||||
and the `slop` controls the maximum number of intervening unmatched
|
||||
|
|
|
@ -6,24 +6,28 @@ query maps to Lucene `SpanNotQuery`. Here is an example:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The `include` and `exclude` clauses can be any span type query. The
|
||||
`include` clause is the span query whose matches are filtered, and the
|
||||
|
|
|
@ -6,25 +6,37 @@ Matches spans containing a term. The span term query maps to Lucene
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"span_term" : { "user" : "kimchy" }
|
||||
"query": {
|
||||
"span_term" : { "user" : "kimchy" }
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
A boost can also be associated with the query:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } }
|
||||
"query": {
|
||||
"span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } }
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
Or :
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } }
|
||||
"query": {
|
||||
"span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } }
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
|
|
@ -6,24 +6,28 @@ query maps to Lucene `SpanWithinQuery`. Here is an example:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The `big` and `little` clauses can be any span type query. Matching
|
||||
spans from `little` that are enclosed within `big` are returned.
|
||||
|
|
|
@ -6,14 +6,18 @@ Filters documents that have fields that match any of the provided terms
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"constant_score" : {
|
||||
"filter" : {
|
||||
"terms" : { "user" : ["kimchy", "elasticsearch"]}
|
||||
"query": {
|
||||
"constant_score" : {
|
||||
"filter" : {
|
||||
"terms" : { "user" : ["kimchy", "elasticsearch"]}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
The `terms` query is also aliased with `in` as the filter name for
|
||||
simpler usage deprecated[5.0.0,use `terms` instead].
|
||||
|
|
Loading…
Reference in New Issue