import { ElasticsearchQueryBuilderOperatorPlugin } from "~/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin" ; import { ElasticsearchBoolQueryConfig , ElasticsearchQueryBuilderArgsPlugin } from "~/types" ; export class ElasticsearchQueryBuilderOperatorNotBetweenPlugin extends ElasticsearchQueryBuilderOperatorPlugin { public name = "elasticsearch.queryBuilder.operator.notBetween.default" ; public getOperator ( ) { return "not_between" ; } public apply ( query , params ) { const { value , basePath } = params ; if ( Array . isArray ( value ) === false ) { throw new Error ( `You cannot filter field path "${ basePath }" with between query and not send an array of values.` ) ; } else if ( value . length !== 2 ) { throw new Error ( `You must pass 2 values in the array for field path "${ basePath }" filtering.` ) ; } const [ gte , lte ] = value ; query . must_not . push ( { range : { [ basePath ] : { lte , gte } } } ) ; } }