包含查询的跨度

编辑

返回包含另一个跨度查询的匹配项。以下是一个示例:

resp = client.search(
    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
                }
            }
        }
    },
)
print(resp)
response = client.search(
  body: {
    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
          }
        }
      }
    }
  }
)
puts response
const response = await client.search({
  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.log(response);
GET /_search
{
  "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
        }
      }
    }
  }
}

biglittle 子句可以是任何跨度类型的查询。返回来自 big 的匹配跨度,这些跨度包含来自 little 的匹配项。