mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
Add CONSOLE to span queries.
... and range, and terms...
This commit is contained in:
parent
754a677ff5
commit
ab4367c07e
@ -96,7 +96,7 @@ passing the `format` parameter to the `range` query:
|
||||
--------------------------------------------------
|
||||
GET _search
|
||||
{
|
||||
"query":
|
||||
"query": {
|
||||
"range" : {
|
||||
"born" : {
|
||||
"gte": "01/01/2012",
|
||||
@ -104,6 +104,7 @@ GET _search
|
||||
"format": "dd/MM/yyyy||yyyy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
@ -6,7 +6,9 @@ query maps to Lucene `SpanContainingQuery`. Here is an example:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_containing" : {
|
||||
"little" : {
|
||||
"span_term" : { "field1" : "foo" }
|
||||
@ -22,8 +24,10 @@ query maps to Lucene `SpanContainingQuery`. Here is an example:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
"query": {
|
||||
"span_multi":{
|
||||
"match":{
|
||||
"prefix" : { "user" : { "value" : "ki" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
A boost can also be associated with the query:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_multi":{
|
||||
"match":{
|
||||
"prefix" : { "user" : { "value" : "ki", "boost" : 1.08 } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
@ -8,7 +8,9 @@ matches are required to be in-order. The span near query maps to Lucene
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_near" : {
|
||||
"clauses" : [
|
||||
{ "span_term" : { "field" : "value1" } },
|
||||
@ -18,8 +20,10 @@ matches are required to be in-order. The span near query maps to Lucene
|
||||
"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,7 +6,9 @@ query maps to Lucene `SpanNotQuery`. Here is an example:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_not" : {
|
||||
"include" : {
|
||||
"span_term" : { "field1" : "hoya" }
|
||||
@ -22,8 +24,10 @@ query maps to Lucene `SpanNotQuery`. Here is an example:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
"query": {
|
||||
"span_term" : { "user" : "kimchy" }
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
A boost can also be associated with the query:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_term" : { "user" : { "value" : "kimchy", "boost" : 2.0 } }
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
Or :
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_term" : { "user" : { "term" : "kimchy", "boost" : 2.0 } }
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
@ -6,7 +6,9 @@ query maps to Lucene `SpanWithinQuery`. Here is an example:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET /_search
|
||||
{
|
||||
"query": {
|
||||
"span_within" : {
|
||||
"little" : {
|
||||
"span_term" : { "field1" : "foo" }
|
||||
@ -22,8 +24,10 @@ query maps to Lucene `SpanWithinQuery`. Here is an example:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--------------------------------------------------
|
||||
// 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
|
||||
{
|
||||
"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…
x
Reference in New Issue
Block a user