跨度词项查询编辑

匹配包含词项的跨度。以下是一个示例

response = client.search(
  body: {
    query: {
      span_term: {
        'user.id' => 'kimchy'
      }
    }
  }
)
puts response
GET /_search
{
  "query": {
    "span_term" : { "user.id" : "kimchy" }
  }
}

查询也可以关联一个提升值

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 } }
  }
}

或者

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 } }
  }
}