IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Span term query
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Span term query
editMatches spans containing a term. The span term query maps to Lucene
SpanTermQuery. Here is an example:
response = client.search(
body: {
query: {
span_term: {
'user.id' => 'kimchy'
}
}
}
)
puts response
GET /_search
{
"query": {
"span_term" : { "user.id" : "kimchy" }
}
}
A boost can also be associated with the query:
response = client.search(
body: {
query: {
span_term: {
'user.id' => {
value: 'kimchy',
boost: 2
}
}
}
}
)
puts response
GET /_search
{
"query": {
"span_term" : { "user.id" : { "value" : "kimchy", "boost" : 2.0 } }
}
}
Or :
response = client.search(
body: {
query: {
span_term: {
'user.id' => {
term: 'kimchy',
boost: 2
}
}
}
}
)
puts response
GET /_search
{
"query": {
"span_term" : { "user.id" : { "term" : "kimchy", "boost" : 2.0 } }
}
}