Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
buildOwnQuery(query){
return query.setAggs(FilterBucket(
"geo", query.getFilters(),
GeohashBucket(
"areas", "location",
{precision:this.precision, size:100},
GeoBoundsMetric("cell", "location")
),
SignificantTermsBucket("significant","crime_type.raw", {size:2}),
GeoBoundsMetric("bounds", "location")
))
}
}
search(query, queryString) {
return query.setAggs(
FilterBucket(
this.options.id, MultiMatchQuery(queryString, {
type: "phrase_prefix",
fields: this.options.searchFields
}),
TopHitsMetric('tophits', {
size: this.options.size,
_source: this.options.searchFields
})
)
)
}
getRangeBucket(query) {
const otherAppliedFiltersOnPath = this.createFilterForOtherElementsOnPath(
query
)
const rangeBucket = this.createInnerRangeBucket()
if (otherAppliedFiltersOnPath) {
return FilterBucket(this.key, otherAppliedFiltersOnPath, rangeBucket)
} else {
return rangeBucket
}
}
termsKey,
this.key,
_.omitBy(
{
size: this.size,
order: this.getOrder(),
include: this.options.include,
exclude: this.options.exclude,
min_doc_count: this.options.min_doc_count
},
_.isUndefined
)
)
if (otherAppliedFiltersOnPath) {
return FilterBucket(this.key, otherAppliedFiltersOnPath, termsBucket)
} else {
return termsBucket
}
}
const min = val.min;
const max = val.max;
let otherFilters = query.getFiltersWithoutKeys(this.key);
let filters = BoolMust([
otherFilters,
RangeQuery(this.options.field,{
gte:min,
lt: this.addOneDay(val.max),
format: 'yyyy-MM-dd'
})
]);
const metric = CardinalityMetric(this.key, this.options.field);
return query.setAggs(FilterBucket(
this.key,
filters,
metric
));
}
}
buildOwnQuery(query) {
let filters = query.getFilters()
if (!this.state.getValue()){
if (filters) filters = BoolMust([filters, this.filter])
else filters = this.filter
}
return query
.setAggs(FilterBucket(
this.key,
filters
))
}
}
buildOwnQuery(query) {
return query.setAggs(FilterBucket(
this.key,
query.getFiltersWithoutKeys(this.uuid),
RangeBucket(
this.key,
this.options.field,
this.getRanges()
)
))
}
buildOwnQuery(query) {
return query.setAggs(
new FilterBucket(
'geo',
query.getFilters(),
new GeohashBucket('areas', 'location', {}, new GeoBoundsMetric('cell', 'location')),
{},
new GeoBoundsMetric('bounds', 'location')
)
);
}
}
search(query, queryString){
return query.setAggs(
FilterBucket(
this.options.id, MultiMatchQuery(queryString,{
type:"phrase_prefix",
fields:["title"]
}),
TopHitsMetric('tophits', {
size:3,
_source:['title', 'imdbId']
})
)
)
}