mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 19:52:53 +00:00
feat: add support for range filters
This commit is contained in:
committed by
Rainer Killinger
parent
785813c3fb
commit
dcf7906f79
@@ -283,6 +283,53 @@ export interface ESTermFilter {
|
||||
};
|
||||
}
|
||||
|
||||
export interface ESGenericRange<T> {
|
||||
/**
|
||||
* Greater than field
|
||||
*/
|
||||
gt?: T;
|
||||
|
||||
/**
|
||||
* Greater or equal than field
|
||||
*/
|
||||
gte?: T;
|
||||
|
||||
/**
|
||||
* Less than field
|
||||
*/
|
||||
lt?: T;
|
||||
|
||||
/**
|
||||
* Less or equal than field
|
||||
*/
|
||||
lte?: T;
|
||||
}
|
||||
|
||||
interface ESGenericRangeFilter<G, T extends ESGenericRange<G>> {
|
||||
/**
|
||||
* Range filter definition
|
||||
*/
|
||||
range: {
|
||||
[fieldName: string]: T;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ESDateRange extends ESGenericRange<string> {
|
||||
/**
|
||||
* Optional date format override
|
||||
*/
|
||||
format?: string;
|
||||
|
||||
/**
|
||||
* Optional timezone specifier
|
||||
*/
|
||||
time_zone?: string;
|
||||
}
|
||||
|
||||
export type ESNumericRangeFilter = ESGenericRangeFilter<number, ESGenericRange<number>>;
|
||||
export type ESDateRangeFilter = ESGenericRangeFilter<string, ESDateRange>;
|
||||
export type ESRangeFilter = ESNumericRangeFilter | ESDateRangeFilter;
|
||||
|
||||
/**
|
||||
* Checks if the parameter is of type ESTermsFilter
|
||||
* @param agg the value to check
|
||||
@@ -435,9 +482,9 @@ export interface ESFunctionScoreQueryFunction {
|
||||
}
|
||||
|
||||
/**
|
||||
* An elasticsearch ducet sort
|
||||
* An elasticsearch generic sort
|
||||
*/
|
||||
export interface ESDucetSort {
|
||||
export interface ESGenericSort {
|
||||
[field: string]: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user