Span Containing query
More info about Boosting query is in the official elasticsearch docs
Returns matches which enclose another span 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
}
}
}
}
And now the query via DSL:
$spanTermQuery = new SpanTermQuery('field1', 'foo');
$spanNearQuery = new SpanNearQuery();
$spanNearQuery->setSlop(5);
$spanNearQuery->addParameter('in_order', true);
$spanNearQuery->addQuery(new SpanTermQuery('field1', 'bar'));
$spanNearQuery->addQuery(new SpanTermQuery('field1', 'baz'));
$spanContainingQuery = new SpanContainingQuery(
$spanTermQuery,
$spanNearQuery
);