@webiny/api-opensearch 0.0.0-unstable.e6f0dc8ca7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/client.d.ts +8 -0
- package/client.js +70 -0
- package/client.js.map +1 -0
- package/cursors.d.ts +10 -0
- package/cursors.js +37 -0
- package/cursors.js.map +1 -0
- package/db/entity.d.ts +7 -0
- package/db/entity.js +20 -0
- package/db/entity.js.map +1 -0
- package/db/index.d.ts +3 -0
- package/db/index.js +5 -0
- package/db/index.js.map +1 -0
- package/db/table.d.ts +7 -0
- package/db/table.js +17 -0
- package/db/table.js.map +1 -0
- package/db/types.d.ts +6 -0
- package/db/types.js +3 -0
- package/db/types.js.map +1 -0
- package/exports/api/opensearch.d.ts +4 -0
- package/exports/api/opensearch.js +6 -0
- package/exports/api/opensearch.js.map +1 -0
- package/features/OpenSearchClient/OpenSearchClient.d.ts +12 -0
- package/features/OpenSearchClient/OpenSearchClient.js +16 -0
- package/features/OpenSearchClient/OpenSearchClient.js.map +1 -0
- package/features/OpenSearchClient/abstraction.d.ts +9 -0
- package/features/OpenSearchClient/abstraction.js +4 -0
- package/features/OpenSearchClient/abstraction.js.map +1 -0
- package/features/OpenSearchClient/feature.d.ts +4 -0
- package/features/OpenSearchClient/feature.js +10 -0
- package/features/OpenSearchClient/feature.js.map +1 -0
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.d.ts +9 -0
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.js +16 -0
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.js.map +1 -0
- package/features/OpenSearchClientFactory/abstraction.d.ts +10 -0
- package/features/OpenSearchClientFactory/abstraction.js +4 -0
- package/features/OpenSearchClientFactory/abstraction.js.map +1 -0
- package/features/OpenSearchClientFactory/feature.d.ts +4 -0
- package/features/OpenSearchClientFactory/feature.js +10 -0
- package/features/OpenSearchClientFactory/feature.js.map +1 -0
- package/features/OpenSearchContext/OpenSearchContext.d.ts +8 -0
- package/features/OpenSearchContext/OpenSearchContext.js +13 -0
- package/features/OpenSearchContext/OpenSearchContext.js.map +1 -0
- package/features/OpenSearchContext/abstraction.d.ts +14 -0
- package/features/OpenSearchContext/abstraction.js +4 -0
- package/features/OpenSearchContext/abstraction.js.map +1 -0
- package/features/OpenSearchContext/feature.d.ts +5 -0
- package/features/OpenSearchContext/feature.js +13 -0
- package/features/OpenSearchContext/feature.js.map +1 -0
- package/index.d.ts +21 -0
- package/index.js +40 -0
- package/index.js.map +1 -0
- package/indexConfiguration/base.d.ts +6 -0
- package/indexConfiguration/base.js +35 -0
- package/indexConfiguration/base.js.map +1 -0
- package/indexConfiguration/common.d.ts +9 -0
- package/indexConfiguration/common.js +44 -0
- package/indexConfiguration/common.js.map +1 -0
- package/indexConfiguration/index.d.ts +2 -0
- package/indexConfiguration/index.js +4 -0
- package/indexConfiguration/index.js.map +1 -0
- package/indexPrefix.d.ts +1 -0
- package/indexPrefix.js +5 -0
- package/indexPrefix.js.map +1 -0
- package/indices.d.ts +8 -0
- package/indices.js +20 -0
- package/indices.js.map +1 -0
- package/limit.d.ts +1 -0
- package/limit.js +32 -0
- package/limit.js.map +1 -0
- package/normalize.d.ts +6 -0
- package/normalize.js +54 -0
- package/normalize.js.map +1 -0
- package/operations/OpenSearchCatHealth.d.ts +7 -0
- package/operations/OpenSearchCatHealth.js +31 -0
- package/operations/OpenSearchCatHealth.js.map +1 -0
- package/operations/OpenSearchCatNodes.d.ts +7 -0
- package/operations/OpenSearchCatNodes.js +29 -0
- package/operations/OpenSearchCatNodes.js.map +1 -0
- package/operations/index.d.ts +3 -0
- package/operations/index.js +5 -0
- package/operations/index.js.map +1 -0
- package/operations/stripConnectionFromException.d.ts +1 -0
- package/operations/stripConnectionFromException.js +17 -0
- package/operations/stripConnectionFromException.js.map +1 -0
- package/operations/types.d.ts +12 -0
- package/operations/types.js +8 -0
- package/operations/types.js.map +1 -0
- package/operators.d.ts +6 -0
- package/operators.js +9 -0
- package/operators.js.map +1 -0
- package/package.json +40 -0
- package/plugins/definition/OpenSearchBodyModifierPlugin.d.ts +13 -0
- package/plugins/definition/OpenSearchBodyModifierPlugin.js +18 -0
- package/plugins/definition/OpenSearchBodyModifierPlugin.js.map +1 -0
- package/plugins/definition/OpenSearchFieldPlugin.d.ts +81 -0
- package/plugins/definition/OpenSearchFieldPlugin.js +69 -0
- package/plugins/definition/OpenSearchFieldPlugin.js.map +1 -0
- package/plugins/definition/OpenSearchIndexPlugin.d.ts +10 -0
- package/plugins/definition/OpenSearchIndexPlugin.js +17 -0
- package/plugins/definition/OpenSearchIndexPlugin.js.map +1 -0
- package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.d.ts +10 -0
- package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js +9 -0
- package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js.map +1 -0
- package/plugins/definition/OpenSearchQueryModifierPlugin.d.ts +14 -0
- package/plugins/definition/OpenSearchQueryModifierPlugin.js +18 -0
- package/plugins/definition/OpenSearchQueryModifierPlugin.js.map +1 -0
- package/plugins/definition/OpenSearchSortModifierPlugin.d.ts +13 -0
- package/plugins/definition/OpenSearchSortModifierPlugin.js +18 -0
- package/plugins/definition/OpenSearchSortModifierPlugin.js.map +1 -0
- package/plugins/definition/index.d.ts +6 -0
- package/plugins/definition/index.js +8 -0
- package/plugins/definition/index.js.map +1 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +4 -0
- package/plugins/index.js.map +1 -0
- package/plugins/operator/andIn.d.ts +7 -0
- package/plugins/operator/andIn.js +35 -0
- package/plugins/operator/andIn.js.map +1 -0
- package/plugins/operator/between.d.ts +7 -0
- package/plugins/operator/between.js +32 -0
- package/plugins/operator/between.js.map +1 -0
- package/plugins/operator/contains.d.ts +7 -0
- package/plugins/operator/contains.js +24 -0
- package/plugins/operator/contains.js.map +1 -0
- package/plugins/operator/equal.d.ts +7 -0
- package/plugins/operator/equal.js +50 -0
- package/plugins/operator/equal.js.map +1 -0
- package/plugins/operator/gt.d.ts +7 -0
- package/plugins/operator/gt.js +22 -0
- package/plugins/operator/gt.js.map +1 -0
- package/plugins/operator/gte.d.ts +7 -0
- package/plugins/operator/gte.js +22 -0
- package/plugins/operator/gte.js.map +1 -0
- package/plugins/operator/in.d.ts +7 -0
- package/plugins/operator/in.js +29 -0
- package/plugins/operator/in.js.map +1 -0
- package/plugins/operator/index.d.ts +15 -0
- package/plugins/operator/index.js +17 -0
- package/plugins/operator/index.js.map +1 -0
- package/plugins/operator/lt.d.ts +7 -0
- package/plugins/operator/lt.js +22 -0
- package/plugins/operator/lt.js.map +1 -0
- package/plugins/operator/lte.d.ts +7 -0
- package/plugins/operator/lte.js +22 -0
- package/plugins/operator/lte.js.map +1 -0
- package/plugins/operator/not.d.ts +7 -0
- package/plugins/operator/not.js +44 -0
- package/plugins/operator/not.js.map +1 -0
- package/plugins/operator/notBetween.d.ts +7 -0
- package/plugins/operator/notBetween.js +32 -0
- package/plugins/operator/notBetween.js.map +1 -0
- package/plugins/operator/notContains.d.ts +7 -0
- package/plugins/operator/notContains.js +24 -0
- package/plugins/operator/notContains.js.map +1 -0
- package/plugins/operator/notIn.d.ts +7 -0
- package/plugins/operator/notIn.js +27 -0
- package/plugins/operator/notIn.js.map +1 -0
- package/plugins/operator/notStartsWith.d.ts +7 -0
- package/plugins/operator/notStartsWith.js +23 -0
- package/plugins/operator/notStartsWith.js.map +1 -0
- package/plugins/operator/startsWith.d.ts +7 -0
- package/plugins/operator/startsWith.js +23 -0
- package/plugins/operator/startsWith.js.map +1 -0
- package/sharedIndex.d.ts +1 -0
- package/sharedIndex.js +5 -0
- package/sharedIndex.js.map +1 -0
- package/sort.d.ts +13 -0
- package/sort.js +65 -0
- package/sort.js.map +1 -0
- package/types.d.ts +68 -0
- package/types.js +68 -0
- package/types.js.map +1 -0
- package/utils/createIndex.d.ts +19 -0
- package/utils/createIndex.js +88 -0
- package/utils/createIndex.js.map +1 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +4 -0
- package/utils/index.js.map +1 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.d.ts +4 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +11 -0
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.d.ts +72 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +161 -0
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.d.ts +4 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +11 -0
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -0
- package/utils/waitUntilHealthy/index.d.ts +4 -0
- package/utils/waitUntilHealthy/index.js +6 -0
- package/utils/waitUntilHealthy/index.js.map +1 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.d.ts +15 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +13 -0
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/IReason.d.ts +4 -0
- package/utils/waitUntilHealthy/reason/IReason.js +3 -0
- package/utils/waitUntilHealthy/reason/IReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js +13 -0
- package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.d.ts +14 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.js +13 -0
- package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -0
- package/utils/waitUntilHealthy/reason/index.d.ts +3 -0
- package/utils/waitUntilHealthy/reason/index.js +5 -0
- package/utils/waitUntilHealthy/reason/index.js.map +1 -0
- package/where.d.ts +17 -0
- package/where.js +82 -0
- package/where.js.map +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.in.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "in";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value: values,
|
|
10
|
+
path,
|
|
11
|
+
basePath,
|
|
12
|
+
name
|
|
13
|
+
} = params;
|
|
14
|
+
const isArray = Array.isArray(values);
|
|
15
|
+
if (isArray === false || values.length === 0) {
|
|
16
|
+
throw new Error(`You cannot filter field "${name}" with "in" operator and not send an array of values.`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Only use ".keyword" if all of the provided values are strings.
|
|
20
|
+
const useBasePath = values.some(value => typeof value !== "string");
|
|
21
|
+
query.filter.push({
|
|
22
|
+
terms: {
|
|
23
|
+
[useBasePath ? basePath : path]: values
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorInPlugin","name","getOperator","apply","query","params","value","values","path","basePath","isArray","Array","length","Error","useBasePath","some","filter","push","terms"],"sources":["in.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorInPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.in.default\";\n\n public getOperator(): string {\n return \"in\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value: values, path, basePath, name } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${name}\" with \"in\" operator and not send an array of values.`\n );\n }\n\n // Only use \".keyword\" if all of the provided values are strings.\n const useBasePath = values.some(\n (value: string | number | boolean | null | undefined) => typeof value !== \"string\"\n );\n\n query.filter.push({\n terms: {\n [useBasePath ? basePath : path]: values\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,sCAAsC,SAASD,oCAAoC,CAAC;EAC7EE,IAAI,GAAG,6CAA6C;EAE7DC,WAAWA,CAAA,EAAW;IACzB,OAAO,IAAI;EACf;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK,EAAEC,MAAM;MAAEC,IAAI;MAAEC,QAAQ;MAAER;IAAK,CAAC,GAAGI,MAAM;IACtD,MAAMK,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACH,MAAM,CAAC;IACrC,IAAIG,OAAO,KAAK,KAAK,IAAIH,MAAM,CAACK,MAAM,KAAK,CAAC,EAAE;MAC1C,MAAM,IAAIC,KAAK,CACX,4BAA4BZ,IAAI,uDACpC,CAAC;IACL;;IAEA;IACA,MAAMa,WAAW,GAAGP,MAAM,CAACQ,IAAI,CAC1BT,KAAmD,IAAK,OAAOA,KAAK,KAAK,QAC9E,CAAC;IAEDF,KAAK,CAACY,MAAM,CAACC,IAAI,CAAC;MACdC,KAAK,EAAE;QACH,CAACJ,WAAW,GAAGL,QAAQ,GAAGD,IAAI,GAAGD;MACrC;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./between.js";
|
|
2
|
+
export * from "./contains.js";
|
|
3
|
+
export * from "./equal.js";
|
|
4
|
+
export * from "./gt.js";
|
|
5
|
+
export * from "./gte.js";
|
|
6
|
+
export * from "./andIn.js";
|
|
7
|
+
export * from "./in.js";
|
|
8
|
+
export * from "./lt.js";
|
|
9
|
+
export * from "./lte.js";
|
|
10
|
+
export * from "./not.js";
|
|
11
|
+
export * from "./notBetween.js";
|
|
12
|
+
export * from "./notContains.js";
|
|
13
|
+
export * from "./notIn.js";
|
|
14
|
+
export * from "./startsWith.js";
|
|
15
|
+
export * from "./notStartsWith.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./between.js";
|
|
2
|
+
export * from "./contains.js";
|
|
3
|
+
export * from "./equal.js";
|
|
4
|
+
export * from "./gt.js";
|
|
5
|
+
export * from "./gte.js";
|
|
6
|
+
export * from "./andIn.js";
|
|
7
|
+
export * from "./in.js";
|
|
8
|
+
export * from "./lt.js";
|
|
9
|
+
export * from "./lte.js";
|
|
10
|
+
export * from "./not.js";
|
|
11
|
+
export * from "./notBetween.js";
|
|
12
|
+
export * from "./notContains.js";
|
|
13
|
+
export * from "./notIn.js";
|
|
14
|
+
export * from "./startsWith.js";
|
|
15
|
+
export * from "./notStartsWith.js";
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./between.js\";\nexport * from \"./contains.js\";\nexport * from \"./equal.js\";\nexport * from \"./gt.js\";\nexport * from \"./gte.js\";\nexport * from \"./andIn.js\";\nexport * from \"./in.js\";\nexport * from \"./lt.js\";\nexport * from \"./lte.js\";\nexport * from \"./not.js\";\nexport * from \"./notBetween.js\";\nexport * from \"./notContains.js\";\nexport * from \"./notIn.js\";\nexport * from \"./startsWith.js\";\nexport * from \"./notStartsWith.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorLesserThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorLesserThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.lesserThan.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "lt";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
basePath
|
|
11
|
+
} = params;
|
|
12
|
+
query.filter.push({
|
|
13
|
+
range: {
|
|
14
|
+
[basePath]: {
|
|
15
|
+
lt: value
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=lt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorLesserThanPlugin","name","getOperator","apply","query","params","value","basePath","filter","push","range","lt"],"sources":["lt.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorLesserThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.lesserThan.default\";\n\n public getOperator(): string {\n return \"lt\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n lt: value\n }\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,8CAA8C,SAASD,oCAAoC,CAAC;EACrFE,IAAI,GAAG,qDAAqD;EAErEC,WAAWA,CAAA,EAAW;IACzB,OAAO,IAAI;EACf;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClCD,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC;MACdC,KAAK,EAAE;QACH,CAACH,QAAQ,GAAG;UACRI,EAAE,EAAEL;QACR;MACJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.lesserThanOrEqualTo.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "lte";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
basePath
|
|
11
|
+
} = params;
|
|
12
|
+
query.filter.push({
|
|
13
|
+
range: {
|
|
14
|
+
[basePath]: {
|
|
15
|
+
lte: value
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=lte.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin","name","getOperator","apply","query","params","value","basePath","filter","push","range","lte"],"sources":["lte.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.lesserThanOrEqualTo.default\";\n\n public getOperator(): string {\n return \"lte\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n lte: value\n }\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,uDAAuD,SAASD,oCAAoC,CAAC;EAC9FE,IAAI,GAAG,8DAA8D;EAE9EC,WAAWA,CAAA,EAAW;IACzB,OAAO,KAAK;EAChB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClCD,KAAK,CAACI,MAAM,CAACC,IAAI,CAAC;MACdC,KAAK,EAAE;QACH,CAACH,QAAQ,GAAG;UACRI,GAAG,EAAEL;QACT;MACJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorNotPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorNotPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.not.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "not";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
path,
|
|
11
|
+
basePath
|
|
12
|
+
} = params;
|
|
13
|
+
if (value === null || value === undefined) {
|
|
14
|
+
query.filter.push({
|
|
15
|
+
exists: {
|
|
16
|
+
field: path
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const typeOf = typeof value;
|
|
22
|
+
if (typeOf === "boolean") {
|
|
23
|
+
query.filter.push({
|
|
24
|
+
bool: {
|
|
25
|
+
must_not: {
|
|
26
|
+
term: {
|
|
27
|
+
[path]: value
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const useBasePath = typeOf !== "string";
|
|
35
|
+
const valuePath = useBasePath ? basePath : path;
|
|
36
|
+
query.must_not.push({
|
|
37
|
+
term: {
|
|
38
|
+
[valuePath]: value
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=not.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorNotPlugin","name","getOperator","apply","query","params","value","path","basePath","undefined","filter","push","exists","field","typeOf","bool","must_not","term","useBasePath","valuePath"],"sources":["not.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorNotPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.not.default\";\n\n public getOperator(): string {\n return \"not\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, path, basePath } = params;\n\n if (value === null || value === undefined) {\n query.filter.push({\n exists: {\n field: path\n }\n });\n return;\n }\n\n const typeOf = typeof value;\n\n if (typeOf === \"boolean\") {\n query.filter.push({\n bool: {\n must_not: {\n term: {\n [path]: value\n }\n }\n }\n });\n return;\n }\n\n const useBasePath = typeOf !== \"string\";\n const valuePath = useBasePath ? basePath : path;\n query.must_not.push({\n term: {\n [valuePath]: value\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,uCAAuC,SAASD,oCAAoC,CAAC;EAC9EE,IAAI,GAAG,8CAA8C;EAE9DC,WAAWA,CAAA,EAAW;IACzB,OAAO,KAAK;EAChB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC,IAAI;MAAEC;IAAS,CAAC,GAAGH,MAAM;IAExC,IAAIC,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKG,SAAS,EAAE;MACvCL,KAAK,CAACM,MAAM,CAACC,IAAI,CAAC;QACdC,MAAM,EAAE;UACJC,KAAK,EAAEN;QACX;MACJ,CAAC,CAAC;MACF;IACJ;IAEA,MAAMO,MAAM,GAAG,OAAOR,KAAK;IAE3B,IAAIQ,MAAM,KAAK,SAAS,EAAE;MACtBV,KAAK,CAACM,MAAM,CAACC,IAAI,CAAC;QACdI,IAAI,EAAE;UACFC,QAAQ,EAAE;YACNC,IAAI,EAAE;cACF,CAACV,IAAI,GAAGD;YACZ;UACJ;QACJ;MACJ,CAAC,CAAC;MACF;IACJ;IAEA,MAAMY,WAAW,GAAGJ,MAAM,KAAK,QAAQ;IACvC,MAAMK,SAAS,GAAGD,WAAW,GAAGV,QAAQ,GAAGD,IAAI;IAC/CH,KAAK,CAACY,QAAQ,CAACL,IAAI,CAAC;MAChBM,IAAI,EAAE;QACF,CAACE,SAAS,GAAGb;MACjB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorNotBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorNotBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.notBetween.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "not_between";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
basePath,
|
|
11
|
+
name
|
|
12
|
+
} = params;
|
|
13
|
+
if (Array.isArray(value) === false) {
|
|
14
|
+
throw new Error(`You cannot filter field path "${name}" with "not_between" query and not send an array of values.`);
|
|
15
|
+
} else if (value.length !== 2) {
|
|
16
|
+
throw new Error(`You must pass 2 values in the array for field path "${name}" filtering.`);
|
|
17
|
+
}
|
|
18
|
+
// we take gte first because it should be a lesser value than lte, eg [5, 10]
|
|
19
|
+
// 6 >= gte && 6 <= lte === true which in this case it means that record will not match
|
|
20
|
+
const [gte, lte] = value;
|
|
21
|
+
query.must_not.push({
|
|
22
|
+
range: {
|
|
23
|
+
[basePath]: {
|
|
24
|
+
lte,
|
|
25
|
+
gte
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=notBetween.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorNotBetweenPlugin","name","getOperator","apply","query","params","value","basePath","Array","isArray","Error","length","gte","lte","must_not","push","range"],"sources":["notBetween.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorNotBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.notBetween.default\";\n\n public getOperator(): string {\n return \"not_between\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath, name } = params;\n if (Array.isArray(value) === false) {\n throw new Error(\n `You cannot filter field path \"${name}\" with \"not_between\" query and not send an array of values.`\n );\n } else if (value.length !== 2) {\n throw new Error(\n `You must pass 2 values in the array for field path \"${name}\" filtering.`\n );\n }\n // we take gte first because it should be a lesser value than lte, eg [5, 10]\n // 6 >= gte && 6 <= lte === true which in this case it means that record will not match\n const [gte, lte] = value;\n query.must_not.push({\n range: {\n [basePath]: {\n lte,\n gte\n }\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,8CAA8C,SAASD,oCAAoC,CAAC;EACrFE,IAAI,GAAG,qDAAqD;EAErEC,WAAWA,CAAA,EAAW;IACzB,OAAO,aAAa;EACxB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC,QAAQ;MAAEN;IAAK,CAAC,GAAGI,MAAM;IACxC,IAAIG,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,KAAK,KAAK,EAAE;MAChC,MAAM,IAAII,KAAK,CACX,iCAAiCT,IAAI,6DACzC,CAAC;IACL,CAAC,MAAM,IAAIK,KAAK,CAACK,MAAM,KAAK,CAAC,EAAE;MAC3B,MAAM,IAAID,KAAK,CACX,uDAAuDT,IAAI,cAC/D,CAAC;IACL;IACA;IACA;IACA,MAAM,CAACW,GAAG,EAAEC,GAAG,CAAC,GAAGP,KAAK;IACxBF,KAAK,CAACU,QAAQ,CAACC,IAAI,CAAC;MAChBC,KAAK,EAAE;QACH,CAACT,QAAQ,GAAG;UACRM,GAAG;UACHD;QACJ;MACJ;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorNotContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import { normalizeValueWithAsterisk } from "../../normalize.js";
|
|
3
|
+
export class OpenSearchQueryBuilderOperatorNotContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name = "opensearch.queryBuilder.operator.notContains.default";
|
|
5
|
+
getOperator() {
|
|
6
|
+
return "not_contains";
|
|
7
|
+
}
|
|
8
|
+
apply(query, params) {
|
|
9
|
+
const {
|
|
10
|
+
value,
|
|
11
|
+
basePath
|
|
12
|
+
} = params;
|
|
13
|
+
query.must_not.push({
|
|
14
|
+
query_string: {
|
|
15
|
+
allow_leading_wildcard: true,
|
|
16
|
+
fields: [basePath],
|
|
17
|
+
query: normalizeValueWithAsterisk(value),
|
|
18
|
+
default_operator: "and"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=notContains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","normalizeValueWithAsterisk","OpenSearchQueryBuilderOperatorNotContainsPlugin","name","getOperator","apply","query","params","value","basePath","must_not","push","query_string","allow_leading_wildcard","fields","default_operator"],"sources":["notContains.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport { normalizeValueWithAsterisk } from \"~/normalize.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorNotContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.notContains.default\";\n\n public getOperator(): string {\n return \"not_contains\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.must_not.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: [basePath],\n query: normalizeValueWithAsterisk(value),\n default_operator: \"and\"\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAC7C,SAASC,0BAA0B;AAGnC,OAAO,MAAMC,+CAA+C,SAASF,oCAAoC,CAAC;EACtFG,IAAI,GAAG,sDAAsD;EAEtEC,WAAWA,CAAA,EAAW;IACzB,OAAO,cAAc;EACzB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClCD,KAAK,CAACI,QAAQ,CAACC,IAAI,CAAC;MAChBC,YAAY,EAAE;QACVC,sBAAsB,EAAE,IAAI;QAC5BC,MAAM,EAAE,CAACL,QAAQ,CAAC;QAClBH,KAAK,EAAEL,0BAA0B,CAACO,KAAK,CAAC;QACxCO,gBAAgB,EAAE;MACtB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorNotInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorNotInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.notIn.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "not_in";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value: values,
|
|
10
|
+
path,
|
|
11
|
+
basePath,
|
|
12
|
+
name
|
|
13
|
+
} = params;
|
|
14
|
+
const isArray = Array.isArray(values);
|
|
15
|
+
if (isArray === false || values.length === 0) {
|
|
16
|
+
throw new Error(`You cannot filter field "${name}" with "not_in" operator and not send an array of values.`);
|
|
17
|
+
}
|
|
18
|
+
const useBasePath = values.some(value => typeof value !== "string");
|
|
19
|
+
query.must_not.push({
|
|
20
|
+
terms: {
|
|
21
|
+
[useBasePath ? basePath : path]: values
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=notIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorNotInPlugin","name","getOperator","apply","query","params","value","values","path","basePath","isArray","Array","length","Error","useBasePath","some","must_not","push","terms"],"sources":["notIn.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorNotInPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.notIn.default\";\n\n public getOperator(): string {\n return \"not_in\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value: values, path, basePath, name } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${name}\" with \"not_in\" operator and not send an array of values.`\n );\n }\n\n const useBasePath = values.some(\n (value: string | number | boolean | null | undefined) => typeof value !== \"string\"\n );\n\n query.must_not.push({\n terms: {\n [useBasePath ? basePath : path]: values\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,yCAAyC,SAASD,oCAAoC,CAAC;EAChFE,IAAI,GAAG,gDAAgD;EAEhEC,WAAWA,CAAA,EAAW;IACzB,OAAO,QAAQ;EACnB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK,EAAEC,MAAM;MAAEC,IAAI;MAAEC,QAAQ;MAAER;IAAK,CAAC,GAAGI,MAAM;IACtD,MAAMK,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACH,MAAM,CAAC;IACrC,IAAIG,OAAO,KAAK,KAAK,IAAIH,MAAM,CAACK,MAAM,KAAK,CAAC,EAAE;MAC1C,MAAM,IAAIC,KAAK,CACX,4BAA4BZ,IAAI,2DACpC,CAAC;IACL;IAEA,MAAMa,WAAW,GAAGP,MAAM,CAACQ,IAAI,CAC1BT,KAAmD,IAAK,OAAOA,KAAK,KAAK,QAC9E,CAAC;IAEDF,KAAK,CAACY,QAAQ,CAACC,IAAI,CAAC;MAChBC,KAAK,EAAE;QACH,CAACJ,WAAW,GAAGL,QAAQ,GAAGD,IAAI,GAAGD;MACrC;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorNotStartsWithPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorNotStartsWithPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.notStartsWith.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "not_startsWith";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
basePath
|
|
11
|
+
} = params;
|
|
12
|
+
if (value === "" || value === null || value === undefined) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
query.must_not.push({
|
|
16
|
+
match_phrase_prefix: {
|
|
17
|
+
[basePath]: value
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=notStartsWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorNotStartsWithPlugin","name","getOperator","apply","query","params","value","basePath","undefined","must_not","push","match_phrase_prefix"],"sources":["notStartsWith.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorNotStartsWithPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.notStartsWith.default\";\n\n public getOperator(): string {\n return \"not_startsWith\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n if (value === \"\" || value === null || value === undefined) {\n return;\n }\n query.must_not.push({\n match_phrase_prefix: {\n [basePath]: value\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,iDAAiD,SAASD,oCAAoC,CAAC;EACxFE,IAAI,GAAG,wDAAwD;EAExEC,WAAWA,CAAA,EAAW;IACzB,OAAO,gBAAgB;EAC3B;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClC,IAAIC,KAAK,KAAK,EAAE,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKE,SAAS,EAAE;MACvD;IACJ;IACAJ,KAAK,CAACK,QAAQ,CAACC,IAAI,CAAC;MAChBC,mBAAmB,EAAE;QACjB,CAACJ,QAAQ,GAAGD;MAChB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../../plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
import type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from "../../types.js";
|
|
3
|
+
export declare class OpenSearchQueryBuilderOperatorStartsWithPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
getOperator(): string;
|
|
6
|
+
apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
+
export class OpenSearchQueryBuilderOperatorStartsWithPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
name = "opensearch.queryBuilder.operator.startsWith.default";
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "startsWith";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const {
|
|
9
|
+
value,
|
|
10
|
+
basePath
|
|
11
|
+
} = params;
|
|
12
|
+
if (value === "" || value === null || value === undefined) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
query.filter.push({
|
|
16
|
+
match_phrase_prefix: {
|
|
17
|
+
[basePath]: value
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=startsWith.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OpenSearchQueryBuilderOperatorPlugin","OpenSearchQueryBuilderOperatorStartsWithPlugin","name","getOperator","apply","query","params","value","basePath","undefined","filter","push","match_phrase_prefix"],"sources":["startsWith.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorStartsWithPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.startsWith.default\";\n\n public getOperator(): string {\n return \"startsWith\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n if (value === \"\" || value === null || value === undefined) {\n return;\n }\n query.filter.push({\n match_phrase_prefix: {\n [basePath]: value\n }\n });\n }\n}\n"],"mappings":"AAAA,SAASA,oCAAoC;AAG7C,OAAO,MAAMC,8CAA8C,SAASD,oCAAoC,CAAC;EACrFE,IAAI,GAAG,qDAAqD;EAErEC,WAAWA,CAAA,EAAW;IACzB,OAAO,YAAY;EACvB;EAEOC,KAAKA,CAACC,KAAgC,EAAEC,MAAwC,EAAQ;IAC3F,MAAM;MAAEC,KAAK;MAAEC;IAAS,CAAC,GAAGF,MAAM;IAClC,IAAIC,KAAK,KAAK,EAAE,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKE,SAAS,EAAE;MACvD;IACJ;IACAJ,KAAK,CAACK,MAAM,CAACC,IAAI,CAAC;MACdC,mBAAmB,EAAE;QACjB,CAACJ,QAAQ,GAAGD;MAChB;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
package/sharedIndex.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isSharedOpenSearchIndex: () => boolean;
|
package/sharedIndex.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isSharedOpenSearchIndex","process","env","OPENSEARCH_SHARED_INDEXES"],"sources":["sharedIndex.ts"],"sourcesContent":["export const isSharedOpenSearchIndex = () => {\n return process.env.OPENSEARCH_SHARED_INDEXES === \"true\";\n};\n"],"mappings":"AAAA,OAAO,MAAMA,uBAAuB,GAAGA,CAAA,KAAM;EACzC,OAAOC,OAAO,CAACC,GAAG,CAACC,yBAAyB,KAAK,MAAM;AAC3D,CAAC","ignoreList":[]}
|
package/sort.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SortOrder, SortType } from "./types.js";
|
|
2
|
+
import { OpenSearchFieldPlugin } from "./plugins/index.js";
|
|
3
|
+
interface CreateSortParams {
|
|
4
|
+
sort: string[];
|
|
5
|
+
defaults?: {
|
|
6
|
+
field?: string;
|
|
7
|
+
order?: SortOrder;
|
|
8
|
+
unmappedType?: string;
|
|
9
|
+
};
|
|
10
|
+
fieldPlugins: Record<string, OpenSearchFieldPlugin>;
|
|
11
|
+
}
|
|
12
|
+
export declare const createSort: (params: CreateSortParams) => SortType;
|
|
13
|
+
export {};
|
package/sort.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { OpenSearchFieldPlugin } from "./plugins/index.js";
|
|
3
|
+
const sortRegExp = /^((?:values\.)?[a-zA-Z0-9_@-]+)_(ASC|DESC)$/;
|
|
4
|
+
export const createSort = params => {
|
|
5
|
+
const {
|
|
6
|
+
sort,
|
|
7
|
+
defaults,
|
|
8
|
+
fieldPlugins
|
|
9
|
+
} = params;
|
|
10
|
+
if (!sort || sort.length === 0) {
|
|
11
|
+
const {
|
|
12
|
+
field,
|
|
13
|
+
order,
|
|
14
|
+
unmappedType
|
|
15
|
+
} = defaults || {};
|
|
16
|
+
/**
|
|
17
|
+
* We say that our system defaults is always id since all records we create have some kind of primary ID.
|
|
18
|
+
*/
|
|
19
|
+
return {
|
|
20
|
+
[field || "id.keyword"]: {
|
|
21
|
+
order: order || "desc",
|
|
22
|
+
// TODO: Cast to the proper MappingFieldType once deep opensearch _types/ imports are resolvable under bundler resolution.
|
|
23
|
+
unmapped_type: unmappedType || undefined
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Cast as string because nothing else should be allowed yet.
|
|
29
|
+
*/
|
|
30
|
+
const result = sort.reduce((acc, value) => {
|
|
31
|
+
if (typeof value !== "string") {
|
|
32
|
+
throw new WebinyError(`Sort as object is not supported..`);
|
|
33
|
+
}
|
|
34
|
+
const match = value.match(sortRegExp);
|
|
35
|
+
if (!match) {
|
|
36
|
+
throw new WebinyError(`Cannot sort by "${value}".`);
|
|
37
|
+
}
|
|
38
|
+
const [, field, initialOrder] = match;
|
|
39
|
+
const order = initialOrder.toLowerCase() === "asc" ? "asc" : "desc";
|
|
40
|
+
const plugin = fieldPlugins[field] || fieldPlugins[OpenSearchFieldPlugin.ALL];
|
|
41
|
+
if (!plugin) {
|
|
42
|
+
throw new WebinyError(`Missing plugin for the field "${field}"`, "PLUGIN_SORT_ERROR", {
|
|
43
|
+
field
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* In case field plugin is the global one, change the * with actual field name.
|
|
48
|
+
* Custom path methods will return their own values anyway so replacing * will not matter.
|
|
49
|
+
*/
|
|
50
|
+
const path = plugin.getPath(field);
|
|
51
|
+
acc[path] = plugin.getSortOptions(order);
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
/**
|
|
55
|
+
* If we do not have id in the sort, we add it as we need a tie_breaker for the OpenSearch to be able to sort consistently.
|
|
56
|
+
*/
|
|
57
|
+
if (!result["id.keyword"] && !result["id"]) {
|
|
58
|
+
result["id.keyword"] = {
|
|
59
|
+
order: "asc"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=sort.js.map
|
package/sort.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WebinyError","OpenSearchFieldPlugin","sortRegExp","createSort","params","sort","defaults","fieldPlugins","length","field","order","unmappedType","unmapped_type","undefined","result","reduce","acc","value","match","initialOrder","toLowerCase","plugin","ALL","path","getPath","getSortOptions"],"sources":["sort.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { FieldSortOptions, SortOrder, SortType } from \"~/types.js\";\nimport { OpenSearchFieldPlugin } from \"~/plugins/index.js\";\n\nconst sortRegExp = /^((?:values\\.)?[a-zA-Z0-9_@-]+)_(ASC|DESC)$/;\n\ninterface CreateSortParams {\n sort: string[];\n defaults?: {\n field?: string;\n order?: SortOrder;\n unmappedType?: string;\n };\n fieldPlugins: Record<string, OpenSearchFieldPlugin>;\n}\n\nexport const createSort = (params: CreateSortParams): SortType => {\n const { sort, defaults, fieldPlugins } = params;\n if (!sort || sort.length === 0) {\n const { field, order, unmappedType } = defaults || {};\n /**\n * We say that our system defaults is always id since all records we create have some kind of primary ID.\n */\n return {\n [field || \"id.keyword\"]: {\n order: order || \"desc\",\n // TODO: Cast to the proper MappingFieldType once deep opensearch _types/ imports are resolvable under bundler resolution.\n unmapped_type: (unmappedType || undefined) as any\n }\n };\n }\n /**\n * Cast as string because nothing else should be allowed yet.\n */\n const result = sort.reduce(\n (acc, value) => {\n if (typeof value !== \"string\") {\n throw new WebinyError(`Sort as object is not supported..`);\n }\n const match = value.match(sortRegExp);\n\n if (!match) {\n throw new WebinyError(`Cannot sort by \"${value}\".`);\n }\n\n const [, field, initialOrder] = match;\n const order: SortOrder = initialOrder.toLowerCase() === \"asc\" ? \"asc\" : \"desc\";\n\n const plugin: OpenSearchFieldPlugin =\n fieldPlugins[field] || fieldPlugins[OpenSearchFieldPlugin.ALL];\n if (!plugin) {\n throw new WebinyError(\n `Missing plugin for the field \"${field}\"`,\n \"PLUGIN_SORT_ERROR\",\n {\n field\n }\n );\n }\n /**\n * In case field plugin is the global one, change the * with actual field name.\n * Custom path methods will return their own values anyway so replacing * will not matter.\n */\n const path = plugin.getPath(field);\n\n acc[path] = plugin.getSortOptions(order);\n\n return acc;\n },\n {} as Record<string, FieldSortOptions>\n );\n /**\n * If we do not have id in the sort, we add it as we need a tie_breaker for the OpenSearch to be able to sort consistently.\n */\n if (!result[\"id.keyword\"] && !result[\"id\"]) {\n result[\"id.keyword\"] = {\n order: \"asc\"\n };\n }\n return result;\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,qBAAqB;AAE9B,MAAMC,UAAU,GAAG,6CAA6C;AAYhE,OAAO,MAAMC,UAAU,GAAIC,MAAwB,IAAe;EAC9D,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC;EAAa,CAAC,GAAGH,MAAM;EAC/C,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACG,MAAM,KAAK,CAAC,EAAE;IAC5B,MAAM;MAAEC,KAAK;MAAEC,KAAK;MAAEC;IAAa,CAAC,GAAGL,QAAQ,IAAI,CAAC,CAAC;IACrD;AACR;AACA;IACQ,OAAO;MACH,CAACG,KAAK,IAAI,YAAY,GAAG;QACrBC,KAAK,EAAEA,KAAK,IAAI,MAAM;QACtB;QACAE,aAAa,EAAGD,YAAY,IAAIE;MACpC;IACJ,CAAC;EACL;EACA;AACJ;AACA;EACI,MAAMC,MAAM,GAAGT,IAAI,CAACU,MAAM,CACtB,CAACC,GAAG,EAAEC,KAAK,KAAK;IACZ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC3B,MAAM,IAAIjB,WAAW,CAAC,mCAAmC,CAAC;IAC9D;IACA,MAAMkB,KAAK,GAAGD,KAAK,CAACC,KAAK,CAAChB,UAAU,CAAC;IAErC,IAAI,CAACgB,KAAK,EAAE;MACR,MAAM,IAAIlB,WAAW,CAAC,mBAAmBiB,KAAK,IAAI,CAAC;IACvD;IAEA,MAAM,GAAGR,KAAK,EAAEU,YAAY,CAAC,GAAGD,KAAK;IACrC,MAAMR,KAAgB,GAAGS,YAAY,CAACC,WAAW,CAAC,CAAC,KAAK,KAAK,GAAG,KAAK,GAAG,MAAM;IAE9E,MAAMC,MAA6B,GAC/Bd,YAAY,CAACE,KAAK,CAAC,IAAIF,YAAY,CAACN,qBAAqB,CAACqB,GAAG,CAAC;IAClE,IAAI,CAACD,MAAM,EAAE;MACT,MAAM,IAAIrB,WAAW,CACjB,iCAAiCS,KAAK,GAAG,EACzC,mBAAmB,EACnB;QACIA;MACJ,CACJ,CAAC;IACL;IACA;AACZ;AACA;AACA;IACY,MAAMc,IAAI,GAAGF,MAAM,CAACG,OAAO,CAACf,KAAK,CAAC;IAElCO,GAAG,CAACO,IAAI,CAAC,GAAGF,MAAM,CAACI,cAAc,CAACf,KAAK,CAAC;IAExC,OAAOM,GAAG;EACd,CAAC,EACD,CAAC,CACL,CAAC;EACD;AACJ;AACA;EACI,IAAI,CAACF,MAAM,CAAC,YAAY,CAAC,IAAI,CAACA,MAAM,CAAC,IAAI,CAAC,EAAE;IACxCA,MAAM,CAAC,YAAY,CAAC,GAAG;MACnBJ,KAAK,EAAE;IACX,CAAC;EACL;EACA,OAAOI,MAAM;AACjB,CAAC","ignoreList":[]}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Client } from "@opensearch-project/opensearch";
|
|
2
|
+
import type { Search_RequestBody as SearchRequestBody, Search_Response, Indices_Create_RequestBody } from "@opensearch-project/opensearch/api/index.js";
|
|
3
|
+
import type { Context } from "@webiny/api/types.js";
|
|
4
|
+
type QueryDslQueryContainer = NonNullable<SearchRequestBody["query"]>;
|
|
5
|
+
type QueryDslBoolQuery = NonNullable<QueryDslQueryContainer["bool"]>;
|
|
6
|
+
type SearchSort = NonNullable<SearchRequestBody["sort"]>;
|
|
7
|
+
type SearchSortOrder = "asc" | "desc";
|
|
8
|
+
type _ExtractRecordValue<T> = T extends Record<string, infer V> ? V : never;
|
|
9
|
+
type _SortMember = NonNullable<SearchRequestBody["sort"]> extends (infer U)[] | (infer U) ? U : never;
|
|
10
|
+
type SearchFieldSort = _ExtractRecordValue<Exclude<_SortMember, string>>;
|
|
11
|
+
type DynamicTemplate = NonNullable<NonNullable<Indices_Create_RequestBody["mappings"]>["dynamic_templates"]>[number][string];
|
|
12
|
+
export type { ApiResponse } from "@opensearch-project/opensearch";
|
|
13
|
+
export type { Client };
|
|
14
|
+
/** Replaces elastic-ts PrimitiveValue. Aligns with opensearch FieldValue. */
|
|
15
|
+
export type PrimitiveValue = boolean | undefined | number | string;
|
|
16
|
+
/** Replaces elastic-ts Query */
|
|
17
|
+
export type { QueryDslQueryContainer };
|
|
18
|
+
/** Replaces elastic-ts BoolQueryConfig */
|
|
19
|
+
export type { QueryDslBoolQuery };
|
|
20
|
+
/** Replaces elastic-ts FieldSortOptions */
|
|
21
|
+
export type FieldSortOptions = SearchFieldSort;
|
|
22
|
+
/** Replaces elastic-ts SortOrder. Narrowed to "asc" | "desc" (excludes "_doc"). */
|
|
23
|
+
export type SortOrder = "asc" | "desc";
|
|
24
|
+
/** Replaces elastic-ts Sort */
|
|
25
|
+
export type { SearchSort as Sort };
|
|
26
|
+
/** Single sort entry as an object map. Replaces elastic-ts SortType. */
|
|
27
|
+
export type SortType = Record<string, FieldSortOptions>;
|
|
28
|
+
/** Replaces elastic-ts SearchBody. Overrides search_after to allow PrimitiveValue[] (null | boolean | string | number). */
|
|
29
|
+
export type SearchBody = Omit<SearchRequestBody, "search_after"> & {
|
|
30
|
+
search_after?: PrimitiveValue[];
|
|
31
|
+
};
|
|
32
|
+
export interface OpenSearchContext extends Context {
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use `context.opensearch` instead.
|
|
35
|
+
*/
|
|
36
|
+
elasticsearch: Client;
|
|
37
|
+
opensearch: Client;
|
|
38
|
+
}
|
|
39
|
+
export interface OpenSearchBoolQueryConfig extends QueryDslBoolQuery {
|
|
40
|
+
must: QueryDslQueryContainer[];
|
|
41
|
+
filter: QueryDslQueryContainer[];
|
|
42
|
+
should: QueryDslQueryContainer[];
|
|
43
|
+
must_not: QueryDslQueryContainer[];
|
|
44
|
+
}
|
|
45
|
+
export type OpenSearchQueryOperator = "eq" | "not" | "in" | "not_in" | "contains" | "not_contains" | "between" | "not_between" | "gt" | "gte" | "lt" | "lte" | string;
|
|
46
|
+
export interface OpenSearchQueryBuilderArgsPlugin {
|
|
47
|
+
name: string;
|
|
48
|
+
path: string;
|
|
49
|
+
basePath: string;
|
|
50
|
+
value: any;
|
|
51
|
+
keyword: boolean;
|
|
52
|
+
}
|
|
53
|
+
export type OpenSearchSearchResponseHit = Search_Response["body"]["hits"]["hits"][number];
|
|
54
|
+
export interface OpenSearchSearchResponseAggregationBucket {
|
|
55
|
+
key: PrimitiveValue;
|
|
56
|
+
doc_count: number;
|
|
57
|
+
}
|
|
58
|
+
export type OpenSearchSearchResponseBodyHits = Search_Response["body"]["hits"];
|
|
59
|
+
export type OpenSearchSearchResponseBody = Search_Response["body"];
|
|
60
|
+
export type OpenSearchSearchResponse = Search_Response;
|
|
61
|
+
/**
|
|
62
|
+
* Extract the total count from an opensearch hits response.
|
|
63
|
+
* Handles both `TotalHits` (object with `value`) and plain `number` formats.
|
|
64
|
+
*/
|
|
65
|
+
export declare const getTotalCount: (total: OpenSearchSearchResponseBodyHits["total"]) => number;
|
|
66
|
+
export type OpenSearchIndexRequestBodyMappingsDynamicTemplate = Record<string, DynamicTemplate>;
|
|
67
|
+
export type OpenSearchIndexRequestBody = Indices_Create_RequestBody;
|
|
68
|
+
export type { SearchSortOrder };
|