@webiny/api-opensearch 6.3.0-beta.4 → 6.4.0-beta.0
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/client.js +52 -62
- package/client.js.map +1 -1
- package/cursors.js +20 -32
- package/cursors.js.map +1 -1
- package/db/entity.js +14 -16
- package/db/entity.js.map +1 -1
- package/db/index.js +0 -2
- package/db/table.js +10 -14
- package/db/table.js.map +1 -1
- package/db/types.js +0 -3
- package/exports/api/opensearch.js +0 -2
- package/features/OpenSearchClient/OpenSearchClient.js +13 -10
- package/features/OpenSearchClient/OpenSearchClient.js.map +1 -1
- package/features/OpenSearchClient/abstraction.js +2 -1
- package/features/OpenSearchClient/abstraction.js.map +1 -1
- package/features/OpenSearchClient/feature.js +6 -5
- package/features/OpenSearchClient/feature.js.map +1 -1
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.js +8 -9
- package/features/OpenSearchClientFactory/OpenSearchClientFactory.js.map +1 -1
- package/features/OpenSearchClientFactory/abstraction.js +2 -1
- package/features/OpenSearchClientFactory/abstraction.js.map +1 -1
- package/features/OpenSearchClientFactory/feature.js +6 -5
- package/features/OpenSearchClientFactory/feature.js.map +1 -1
- package/features/OpenSearchContext/OpenSearchContext.js +11 -10
- package/features/OpenSearchContext/OpenSearchContext.js.map +1 -1
- package/features/OpenSearchContext/abstraction.js +2 -1
- package/features/OpenSearchContext/abstraction.js.map +1 -1
- package/features/OpenSearchContext/feature.js +7 -8
- package/features/OpenSearchContext/feature.js.map +1 -1
- package/index.js +14 -16
- package/index.js.map +1 -1
- package/indexConfiguration/base.js +25 -26
- package/indexConfiguration/base.js.map +1 -1
- package/indexConfiguration/common.js +39 -41
- package/indexConfiguration/common.js.map +1 -1
- package/indexConfiguration/index.js +0 -2
- package/indexPrefix.js +2 -3
- package/indexPrefix.js.map +1 -1
- package/indices.js +8 -16
- package/indices.js.map +1 -1
- package/limit.js +5 -27
- package/limit.js.map +1 -1
- package/normalize.js +50 -49
- package/normalize.js.map +1 -1
- package/operations/OpenSearchCatHealth.js +24 -25
- package/operations/OpenSearchCatHealth.js.map +1 -1
- package/operations/OpenSearchCatNodes.js +22 -23
- package/operations/OpenSearchCatNodes.js.map +1 -1
- package/operations/index.js +0 -2
- package/operations/stripConnectionFromException.js +11 -14
- package/operations/stripConnectionFromException.js.map +1 -1
- package/operations/types.js +6 -5
- package/operations/types.js.map +1 -1
- package/operators.js +20 -7
- package/operators.js.map +1 -1
- package/package.json +11 -11
- package/plugins/definition/OpenSearchBodyModifierPlugin.js +12 -13
- package/plugins/definition/OpenSearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definition/OpenSearchFieldPlugin.js +43 -60
- package/plugins/definition/OpenSearchFieldPlugin.js.map +1 -1
- package/plugins/definition/OpenSearchIndexPlugin.js +12 -13
- package/plugins/definition/OpenSearchIndexPlugin.js.map +1 -1
- package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js +5 -5
- package/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js.map +1 -1
- package/plugins/definition/OpenSearchQueryModifierPlugin.js +12 -13
- package/plugins/definition/OpenSearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definition/OpenSearchSortModifierPlugin.js +12 -13
- package/plugins/definition/OpenSearchSortModifierPlugin.js.map +1 -1
- package/plugins/definition/index.js +0 -2
- package/plugins/index.js +0 -2
- package/plugins/operator/andIn.js +20 -28
- package/plugins/operator/andIn.js.map +1 -1
- package/plugins/operator/between.js +21 -27
- package/plugins/operator/between.js.map +1 -1
- package/plugins/operator/contains.js +21 -19
- package/plugins/operator/contains.js.map +1 -1
- package/plugins/operator/equal.js +27 -44
- package/plugins/operator/equal.js.map +1 -1
- package/plugins/operator/gt.js +18 -18
- package/plugins/operator/gt.js.map +1 -1
- package/plugins/operator/gte.js +18 -18
- package/plugins/operator/gte.js.map +1 -1
- package/plugins/operator/in.js +18 -24
- package/plugins/operator/in.js.map +1 -1
- package/plugins/operator/index.js +0 -2
- package/plugins/operator/lt.js +18 -18
- package/plugins/operator/lt.js.map +1 -1
- package/plugins/operator/lte.js +18 -18
- package/plugins/operator/lte.js.map +1 -1
- package/plugins/operator/not.js +29 -36
- package/plugins/operator/not.js.map +1 -1
- package/plugins/operator/notBetween.js +21 -27
- package/plugins/operator/notBetween.js.map +1 -1
- package/plugins/operator/notContains.js +21 -19
- package/plugins/operator/notContains.js.map +1 -1
- package/plugins/operator/notIn.js +18 -22
- package/plugins/operator/notIn.js.map +1 -1
- package/plugins/operator/notStartsWith.js +16 -18
- package/plugins/operator/notStartsWith.js.map +1 -1
- package/plugins/operator/startsWith.js +16 -18
- package/plugins/operator/startsWith.js.map +1 -1
- package/sharedIndex.js +2 -3
- package/sharedIndex.js.map +1 -1
- package/sort.js +29 -58
- package/sort.js.map +1 -1
- package/types.js +5 -65
- package/types.js.map +1 -1
- package/utils/createIndex.js +56 -78
- package/utils/createIndex.js.map +1 -1
- package/utils/index.js +0 -2
- package/utils/waitUntilHealthy/UnhealthyClusterError.js +8 -7
- package/utils/waitUntilHealthy/UnhealthyClusterError.js.map +1 -1
- package/utils/waitUntilHealthy/WaitUntilHealthy.js +111 -141
- package/utils/waitUntilHealthy/WaitUntilHealthy.js.map +1 -1
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js +8 -7
- package/utils/waitUntilHealthy/WaitingHealthyClusterAbortedError.js.map +1 -1
- package/utils/waitUntilHealthy/index.js +0 -2
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js +9 -10
- package/utils/waitUntilHealthy/reason/ClusterHealthReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/IReason.js +0 -3
- package/utils/waitUntilHealthy/reason/MemoryReason.js +9 -10
- package/utils/waitUntilHealthy/reason/MemoryReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/ProcessorReason.js +9 -10
- package/utils/waitUntilHealthy/reason/ProcessorReason.js.map +1 -1
- package/utils/waitUntilHealthy/reason/index.js +0 -2
- package/where.js +41 -74
- package/where.js.map +1 -1
- package/db/index.js.map +0 -1
- package/db/types.js.map +0 -1
- package/exports/api/opensearch.js.map +0 -1
- package/indexConfiguration/index.js.map +0 -1
- package/operations/index.js.map +0 -1
- package/plugins/definition/index.js.map +0 -1
- package/plugins/index.js.map +0 -1
- package/plugins/operator/index.js.map +0 -1
- package/utils/index.js.map +0 -1
- package/utils/waitUntilHealthy/index.js.map +0 -1
- package/utils/waitUntilHealthy/reason/IReason.js.map +0 -1
- package/utils/waitUntilHealthy/reason/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/andIn.js","sources":["../../../src/plugins/operator/andIn.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorAndInPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.andIn.default\";\n\n public getOperator(): string {\n return \"and_in\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value: values, path, basePath } = params;\n const isArray = Array.isArray(values);\n if (isArray === false || values.length === 0) {\n throw new Error(\n `You cannot filter field \"${path}\" with \"in\" operator and not send an array of values.`\n );\n }\n\n let useBasePath = false;\n // Only use \".keyword\" if all of the provided values are strings.\n for (const value of values) {\n if (typeof value !== \"string\") {\n useBasePath = true;\n break;\n }\n }\n\n for (const value of values) {\n query.filter.push({\n term: {\n [useBasePath ? basePath : path]: value\n }\n });\n }\n }\n}\n"],"names":["OpenSearchQueryBuilderOperatorAndInPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","values","path","basePath","isArray","Array","Error","useBasePath","value"],"mappings":";AAGO,MAAMA,kDAAkDC;IAGpD,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAE,OAAOC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGH;QAC1C,MAAMI,UAAUC,MAAM,OAAO,CAACJ;QAC9B,IAAIG,AAAY,UAAZA,WAAqBH,AAAkB,MAAlBA,OAAO,MAAM,EAClC,MAAM,IAAIK,MACN,CAAC,yBAAyB,EAAEJ,KAAK,qDAAqD,CAAC;QAI/F,IAAIK,cAAc;QAElB,KAAK,MAAMC,SAASP,OAChB,IAAI,AAAiB,YAAjB,OAAOO,OAAoB;YAC3BD,cAAc;YACd;QACJ;QAGJ,KAAK,MAAMC,SAASP,OAChBF,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,CAACQ,cAAcJ,WAAWD,KAAK,EAAEM;YACrC;QACJ;IAER;;QAhCG,qBACa,IAAI,GAAG;;AAgC3B"}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
class OpenSearchQueryBuilderOperatorBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "between";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath, name } = params;
|
|
8
|
+
if (false === Array.isArray(value)) throw new Error(`You cannot filter field path "${name}" with between query and not send an array of values.`);
|
|
9
|
+
if (2 !== value.length) throw new Error(`You must pass 2 values in the array for field path "${name}" filtering.`);
|
|
10
|
+
const [gte, lte] = value;
|
|
11
|
+
query.filter.push({
|
|
12
|
+
range: {
|
|
13
|
+
[basePath]: {
|
|
14
|
+
lte,
|
|
15
|
+
gte
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
constructor(...args){
|
|
21
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.between.default";
|
|
17
22
|
}
|
|
18
|
-
// we take gte first because it should be a lesser value than lte, eg [5, 10]
|
|
19
|
-
// 6 >= gte && 6 <= lte
|
|
20
|
-
const [gte, lte] = value;
|
|
21
|
-
query.filter.push({
|
|
22
|
-
range: {
|
|
23
|
-
[basePath]: {
|
|
24
|
-
lte,
|
|
25
|
-
gte
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
23
|
}
|
|
24
|
+
export { OpenSearchQueryBuilderOperatorBetweenPlugin };
|
|
31
25
|
|
|
32
26
|
//# sourceMappingURL=between.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/between.js","sources":["../../../src/plugins/operator/between.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorBetweenPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.between.default\";\n\n public getOperator(): string {\n return \"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 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\n const [gte, lte] = value;\n query.filter.push({\n range: {\n [basePath]: {\n lte,\n gte\n }\n }\n });\n }\n}\n"],"names":["OpenSearchQueryBuilderOperatorBetweenPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","basePath","name","Array","Error","gte","lte"],"mappings":";AAGO,MAAMA,oDAAoDC;IAGtD,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGH;QAClC,IAAII,AAAyB,UAAzBA,MAAM,OAAO,CAACH,QACd,MAAM,IAAII,MACN,CAAC,8BAA8B,EAAEF,KAAK,qDAAqD,CAAC;QAE7F,IAAIF,AAAiB,MAAjBA,MAAM,MAAM,EACnB,MAAM,IAAII,MACN,CAAC,oDAAoD,EAAEF,KAAK,YAAY,CAAC;QAKjF,MAAM,CAACG,KAAKC,IAAI,GAAGN;QACnBF,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACRK;oBACAD;gBACJ;YACJ;QACJ;IACJ;;QA7BG,qBACa,IAAI,GAAG;;AA6B3B"}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
2
|
import { normalizeValueWithAsterisk } from "../../normalize.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
class OpenSearchQueryBuilderOperatorContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
4
|
+
getOperator() {
|
|
5
|
+
return "contains";
|
|
6
|
+
}
|
|
7
|
+
apply(query, params) {
|
|
8
|
+
const { value, basePath } = params;
|
|
9
|
+
query.must.push({
|
|
10
|
+
query_string: {
|
|
11
|
+
allow_leading_wildcard: true,
|
|
12
|
+
fields: [
|
|
13
|
+
basePath
|
|
14
|
+
],
|
|
15
|
+
query: normalizeValueWithAsterisk(value),
|
|
16
|
+
default_operator: "and"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
constructor(...args){
|
|
21
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.contains.default";
|
|
22
|
+
}
|
|
22
23
|
}
|
|
24
|
+
export { OpenSearchQueryBuilderOperatorContainsPlugin };
|
|
23
25
|
|
|
24
26
|
//# sourceMappingURL=contains.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/contains.js","sources":["../../../src/plugins/operator/contains.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport { normalizeValueWithAsterisk } from \"~/normalize.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorContainsPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.contains.default\";\n\n public getOperator(): string {\n return \"contains\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.must.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"],"names":["OpenSearchQueryBuilderOperatorContainsPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","basePath","normalizeValueWithAsterisk"],"mappings":";;AAIO,MAAMA,qDAAqDC;IAGvD,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,IAAI,CAAC,IAAI,CAAC;YACZ,cAAc;gBACV,wBAAwB;gBACxB,QAAQ;oBAACG;iBAAS;gBAClB,OAAOC,2BAA2BF;gBAClC,kBAAkB;YACtB;QACJ;IACJ;;QAjBG,qBACa,IAAI,GAAG;;AAiB3B"}
|
|
@@ -1,50 +1,33 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return "eq";
|
|
6
|
-
}
|
|
7
|
-
apply(query, params) {
|
|
8
|
-
const {
|
|
9
|
-
value,
|
|
10
|
-
path,
|
|
11
|
-
basePath
|
|
12
|
-
} = params;
|
|
13
|
-
if (value === null || value === undefined) {
|
|
14
|
-
query.must_not.push({
|
|
15
|
-
exists: {
|
|
16
|
-
field: path
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return;
|
|
2
|
+
class OpenSearchQueryBuilderOperatorEqualPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "eq";
|
|
20
5
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, path, basePath } = params;
|
|
8
|
+
if (null == value) return void query.must_not.push({
|
|
9
|
+
exists: {
|
|
10
|
+
field: path
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const typeOf = typeof value;
|
|
14
|
+
if ("number" === typeOf || "boolean" === typeOf) return void query.filter.push({
|
|
15
|
+
term: {
|
|
16
|
+
[basePath]: value
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const useBasePath = "string" !== typeOf;
|
|
20
|
+
const valuePath = useBasePath ? basePath : path;
|
|
21
|
+
query.filter.push({
|
|
22
|
+
term: {
|
|
23
|
+
[valuePath]: value
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
constructor(...args){
|
|
28
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.equal.default";
|
|
32
29
|
}
|
|
33
|
-
/**
|
|
34
|
-
* In case we are searching for a string, use regular path.
|
|
35
|
-
* Otherwise use base path.
|
|
36
|
-
*/
|
|
37
|
-
const useBasePath = typeOf !== "string";
|
|
38
|
-
const valuePath = useBasePath ? basePath : path;
|
|
39
|
-
/**
|
|
40
|
-
* String or something else.
|
|
41
|
-
*/
|
|
42
|
-
query.filter.push({
|
|
43
|
-
term: {
|
|
44
|
-
[valuePath]: value
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
30
|
}
|
|
31
|
+
export { OpenSearchQueryBuilderOperatorEqualPlugin };
|
|
49
32
|
|
|
50
33
|
//# sourceMappingURL=equal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/equal.js","sources":["../../../src/plugins/operator/equal.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorEqualPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.equal.default\";\n\n public getOperator(): string {\n return \"eq\";\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.must_not.push({\n exists: {\n field: path\n }\n });\n return;\n }\n const typeOf = typeof value;\n /**\n * If value is a number or boolean, use filtering instead of must/term\n */\n if (typeOf === \"number\" || typeOf === \"boolean\") {\n query.filter.push({\n term: {\n [basePath]: value\n }\n });\n return;\n }\n /**\n * In case we are searching for a string, use regular path.\n * Otherwise use base path.\n */\n const useBasePath = typeOf !== \"string\";\n const valuePath = useBasePath ? basePath : path;\n /**\n * String or something else.\n */\n query.filter.push({\n term: {\n [valuePath]: value\n }\n });\n }\n}\n"],"names":["OpenSearchQueryBuilderOperatorEqualPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","path","basePath","typeOf","useBasePath","valuePath"],"mappings":";AAGO,MAAMA,kDAAkDC;IAGpD,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGH;QAElC,IAAIC,QAAAA,OAAuC,YACvCF,MAAM,QAAQ,CAAC,IAAI,CAAC;YAChB,QAAQ;gBACJ,OAAOG;YACX;QACJ;QAGJ,MAAME,SAAS,OAAOH;QAItB,IAAIG,AAAW,aAAXA,UAAuBA,AAAW,cAAXA,QAAsB,YAC7CL,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,CAACI,SAAS,EAAEF;YAChB;QACJ;QAOJ,MAAMI,cAAcD,AAAW,aAAXA;QACpB,MAAME,YAAYD,cAAcF,WAAWD;QAI3CH,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,CAACO,UAAU,EAAEL;YACjB;QACJ;IACJ;;QA5CG,qBACa,IAAI,GAAG;;AA4C3B"}
|
package/plugins/operator/gt.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
2
|
+
class OpenSearchQueryBuilderOperatorGreaterThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "gt";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
query.filter.push({
|
|
9
|
+
range: {
|
|
10
|
+
[basePath]: {
|
|
11
|
+
gt: value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
constructor(...args){
|
|
17
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.greaterThan.default";
|
|
18
|
+
}
|
|
20
19
|
}
|
|
20
|
+
export { OpenSearchQueryBuilderOperatorGreaterThanPlugin };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=gt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/gt.js","sources":["../../../src/plugins/operator/gt.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorGreaterThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.greaterThan.default\";\n\n public getOperator(): string {\n return \"gt\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n gt: value\n }\n }\n });\n }\n}\n"],"names":["OpenSearchQueryBuilderOperatorGreaterThanPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","basePath"],"mappings":";AAGO,MAAMA,wDAAwDC;IAG1D,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACR,IAAID;gBACR;YACJ;QACJ;IACJ;;QAhBG,qBACa,IAAI,GAAG;;AAgB3B"}
|
package/plugins/operator/gte.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
2
|
+
class OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "gte";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
query.filter.push({
|
|
9
|
+
range: {
|
|
10
|
+
[basePath]: {
|
|
11
|
+
gte: value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
constructor(...args){
|
|
17
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.greaterThanOrEqualTo.default";
|
|
18
|
+
}
|
|
20
19
|
}
|
|
20
|
+
export { OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=gte.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/gte.js","sources":["../../../src/plugins/operator/gte.ts"],"sourcesContent":["import { OpenSearchQueryBuilderOperatorPlugin } from \"~/plugins/definition/OpenSearchQueryBuilderOperatorPlugin.js\";\nimport type { OpenSearchBoolQueryConfig, OpenSearchQueryBuilderArgsPlugin } from \"~/types.js\";\n\nexport class OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {\n public override name = \"opensearch.queryBuilder.operator.greaterThanOrEqualTo.default\";\n\n public getOperator(): string {\n return \"gte\";\n }\n\n public apply(query: OpenSearchBoolQueryConfig, params: OpenSearchQueryBuilderArgsPlugin): void {\n const { value, basePath } = params;\n query.filter.push({\n range: {\n [basePath]: {\n gte: value\n }\n }\n });\n }\n}\n"],"names":["OpenSearchQueryBuilderOperatorGreaterThanOrEqualToPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","basePath"],"mappings":";AAGO,MAAMA,iEAAiEC;IAGnE,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACR,KAAKD;gBACT;YACJ;QACJ;IACJ;;QAhBG,qBACa,IAAI,GAAG;;AAgB3B"}
|
package/plugins/operator/in.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
class OpenSearchQueryBuilderOperatorInPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "in";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value: values, path, basePath, name } = params;
|
|
8
|
+
const isArray = Array.isArray(values);
|
|
9
|
+
if (false === isArray || 0 === values.length) throw new Error(`You cannot filter field "${name}" with "in" operator and not send an array of values.`);
|
|
10
|
+
const useBasePath = values.some((value)=>"string" != typeof value);
|
|
11
|
+
query.filter.push({
|
|
12
|
+
terms: {
|
|
13
|
+
[useBasePath ? basePath : path]: values
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
constructor(...args){
|
|
18
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.in.default";
|
|
17
19
|
}
|
|
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
20
|
}
|
|
21
|
+
export { OpenSearchQueryBuilderOperatorInPlugin };
|
|
28
22
|
|
|
29
23
|
//# sourceMappingURL=in.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/in.js","sources":["../../../src/plugins/operator/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"],"names":["OpenSearchQueryBuilderOperatorInPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","values","path","basePath","name","isArray","Array","Error","useBasePath","value"],"mappings":";AAGO,MAAMA,+CAA+CC;IAGjD,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAE,OAAOC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGJ;QAChD,MAAMK,UAAUC,MAAM,OAAO,CAACL;QAC9B,IAAII,AAAY,UAAZA,WAAqBJ,AAAkB,MAAlBA,OAAO,MAAM,EAClC,MAAM,IAAIM,MACN,CAAC,yBAAyB,EAAEH,KAAK,qDAAqD,CAAC;QAK/F,MAAMI,cAAcP,OAAO,IAAI,CAC3B,CAACQ,QAAwD,AAAiB,YAAjB,OAAOA;QAGpEV,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACS,cAAcL,WAAWD,KAAK,EAAED;YACrC;QACJ;IACJ;;QA1BG,qBACa,IAAI,GAAG;;AA0B3B"}
|
package/plugins/operator/lt.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
2
|
+
class OpenSearchQueryBuilderOperatorLesserThanPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "lt";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
query.filter.push({
|
|
9
|
+
range: {
|
|
10
|
+
[basePath]: {
|
|
11
|
+
lt: value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
constructor(...args){
|
|
17
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.lesserThan.default";
|
|
18
|
+
}
|
|
20
19
|
}
|
|
20
|
+
export { OpenSearchQueryBuilderOperatorLesserThanPlugin };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=lt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/lt.js","sources":["../../../src/plugins/operator/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"],"names":["OpenSearchQueryBuilderOperatorLesserThanPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","basePath"],"mappings":";AAGO,MAAMA,uDAAuDC;IAGzD,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACR,IAAID;gBACR;YACJ;QACJ;IACJ;;QAhBG,qBACa,IAAI,GAAG;;AAgB3B"}
|
package/plugins/operator/lte.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
2
|
+
class OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "lte";
|
|
5
|
+
}
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, basePath } = params;
|
|
8
|
+
query.filter.push({
|
|
9
|
+
range: {
|
|
10
|
+
[basePath]: {
|
|
11
|
+
lte: value
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
constructor(...args){
|
|
17
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.lesserThanOrEqualTo.default";
|
|
18
|
+
}
|
|
20
19
|
}
|
|
20
|
+
export { OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin };
|
|
21
21
|
|
|
22
22
|
//# sourceMappingURL=lte.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/operator/lte.js","sources":["../../../src/plugins/operator/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"],"names":["OpenSearchQueryBuilderOperatorLesserThanOrEqualToPlugin","OpenSearchQueryBuilderOperatorPlugin","query","params","value","basePath"],"mappings":";AAGO,MAAMA,gEAAgEC;IAGlE,cAAsB;QACzB,OAAO;IACX;IAEO,MAAMC,KAAgC,EAAEC,MAAwC,EAAQ;QAC3F,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;QAC5BD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,OAAO;gBACH,CAACG,SAAS,EAAE;oBACR,KAAKD;gBACT;YACJ;QACJ;IACJ;;QAhBG,qBACa,IAAI,GAAG;;AAgB3B"}
|
package/plugins/operator/not.js
CHANGED
|
@@ -1,44 +1,37 @@
|
|
|
1
1
|
import { OpenSearchQueryBuilderOperatorPlugin } from "../definition/OpenSearchQueryBuilderOperatorPlugin.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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;
|
|
2
|
+
class OpenSearchQueryBuilderOperatorNotPlugin extends OpenSearchQueryBuilderOperatorPlugin {
|
|
3
|
+
getOperator() {
|
|
4
|
+
return "not";
|
|
20
5
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
apply(query, params) {
|
|
7
|
+
const { value, path, basePath } = params;
|
|
8
|
+
if (null == value) return void query.filter.push({
|
|
9
|
+
exists: {
|
|
10
|
+
field: path
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const typeOf = typeof value;
|
|
14
|
+
if ("boolean" === typeOf) return void query.filter.push({
|
|
15
|
+
bool: {
|
|
16
|
+
must_not: {
|
|
17
|
+
term: {
|
|
18
|
+
[path]: value
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const useBasePath = "string" !== typeOf;
|
|
24
|
+
const valuePath = useBasePath ? basePath : path;
|
|
25
|
+
query.must_not.push({
|
|
26
26
|
term: {
|
|
27
|
-
|
|
27
|
+
[valuePath]: value
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
constructor(...args){
|
|
32
|
+
super(...args), this.name = "opensearch.queryBuilder.operator.not.default";
|
|
33
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
34
|
}
|
|
35
|
+
export { OpenSearchQueryBuilderOperatorNotPlugin };
|
|
43
36
|
|
|
44
37
|
//# sourceMappingURL=not.js.map
|