Запрос span, содержащий другое условие
Возвращает совпадения, которые охватывают другой запрос span. Вот пример:
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
}
}
}
}
} Условие big и little может быть любым типом запроса span. Возвращаются совпадающие span из big, содержащие совпадения из little.
© 2023-2025 Elasticsearch
As of September 2024, Elasticsearch is available under a choice of three licenses: the Server Side Public License (SSPL), the Elastic License, or the AGPLv3 (OSI approved).
Elasticsearch and the Elasticsearch logo are trademarks of Elasticsearch B.V., registered in the U.S. and in other countries.
https://www.elastic.co/guide/en/elasticsearch/reference/8.17/query-dsl-span-containing-query.html