/
span-within-query.js
33 lines (30 loc) · 990 Bytes
/
span-within-query.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
const SpanLittleBigQueryBase = require('./span-little-big-query-base');
/**
* Returns matches which are enclosed inside another span query. The span within
* query maps to Lucene `SpanWithinQuery`.
*
* Matching spans from `little` that are enclosed within `big` are returned.
*
* [Elasticsearch reference](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-span-containing-query.html)
*
* @example
* const spanQry = esb.spanWithinQuery()
* .little(esb.spanTermQuery('field1', 'foo'))
* .big(esb.spanNearQuery()
* .clauses([
* esb.spanTermQuery('field1', 'bar'),
* esb.spanTermQuery('field1', 'baz')
* ])
* .slop(5)
* .inOrder(true));
*
* @extends SpanLittleBigQueryBase
*/
class SpanWithinQuery extends SpanLittleBigQueryBase {
// eslint-disable-next-line require-jsdoc
constructor() {
super('span_within');
}
}
module.exports = SpanWithinQuery;