范围查询编辑

返回包含在另一个范围查询内的匹配项。以下是一个示例

response = client.search(
  body: {
    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
          }
        }
      }
    }
  }
)
puts response
GET /_search
{
  "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
        }
      }
    }
  }
}

biglittle 子句可以是任何范围类型查询。返回包含在 big 内部的 little 的匹配范围。