elasticlink 0.2.1-beta → 0.2.2-beta

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.
Files changed (64) hide show
  1. package/dist/query.builder.js +1 -1
  2. package/dist/query.types.d.ts +1 -1
  3. package/dist/query.types.d.ts.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/__tests__/aggregation-builder.test.d.ts +0 -2
  6. package/dist/__tests__/aggregation-builder.test.d.ts.map +0 -1
  7. package/dist/__tests__/aggregation-builder.test.js +0 -662
  8. package/dist/__tests__/bulk.test.d.ts +0 -2
  9. package/dist/__tests__/bulk.test.d.ts.map +0 -1
  10. package/dist/__tests__/bulk.test.js +0 -684
  11. package/dist/__tests__/examples.test.d.ts +0 -2
  12. package/dist/__tests__/examples.test.d.ts.map +0 -1
  13. package/dist/__tests__/examples.test.js +0 -2006
  14. package/dist/__tests__/fixtures/finance.d.ts +0 -26
  15. package/dist/__tests__/fixtures/finance.d.ts.map +0 -1
  16. package/dist/__tests__/fixtures/finance.js +0 -32
  17. package/dist/__tests__/fixtures/legal.d.ts +0 -8
  18. package/dist/__tests__/fixtures/legal.d.ts.map +0 -1
  19. package/dist/__tests__/fixtures/legal.js +0 -20
  20. package/dist/__tests__/fixtures/real-estate.d.ts +0 -19
  21. package/dist/__tests__/fixtures/real-estate.d.ts.map +0 -1
  22. package/dist/__tests__/fixtures/real-estate.js +0 -20
  23. package/dist/__tests__/index-management.test.d.ts +0 -2
  24. package/dist/__tests__/index-management.test.d.ts.map +0 -1
  25. package/dist/__tests__/index-management.test.js +0 -1148
  26. package/dist/__tests__/integration/aggregation.integration.test.d.ts +0 -2
  27. package/dist/__tests__/integration/aggregation.integration.test.d.ts.map +0 -1
  28. package/dist/__tests__/integration/aggregation.integration.test.js +0 -200
  29. package/dist/__tests__/integration/bulk.integration.test.d.ts +0 -2
  30. package/dist/__tests__/integration/bulk.integration.test.d.ts.map +0 -1
  31. package/dist/__tests__/integration/bulk.integration.test.js +0 -93
  32. package/dist/__tests__/integration/fixtures/finance.d.ts +0 -17
  33. package/dist/__tests__/integration/fixtures/finance.d.ts.map +0 -1
  34. package/dist/__tests__/integration/fixtures/finance.js +0 -42
  35. package/dist/__tests__/integration/fixtures/legal.d.ts +0 -21
  36. package/dist/__tests__/integration/fixtures/legal.d.ts.map +0 -1
  37. package/dist/__tests__/integration/fixtures/legal.js +0 -52
  38. package/dist/__tests__/integration/fixtures/real-estate.d.ts +0 -7
  39. package/dist/__tests__/integration/fixtures/real-estate.d.ts.map +0 -1
  40. package/dist/__tests__/integration/fixtures/real-estate.js +0 -22
  41. package/dist/__tests__/integration/helpers.d.ts +0 -15
  42. package/dist/__tests__/integration/helpers.d.ts.map +0 -1
  43. package/dist/__tests__/integration/helpers.js +0 -21
  44. package/dist/__tests__/integration/index-management.integration.test.d.ts +0 -2
  45. package/dist/__tests__/integration/index-management.integration.test.d.ts.map +0 -1
  46. package/dist/__tests__/integration/index-management.integration.test.js +0 -79
  47. package/dist/__tests__/integration/multi-search.integration.test.d.ts +0 -2
  48. package/dist/__tests__/integration/multi-search.integration.test.d.ts.map +0 -1
  49. package/dist/__tests__/integration/multi-search.integration.test.js +0 -55
  50. package/dist/__tests__/integration/query.integration.test.d.ts +0 -2
  51. package/dist/__tests__/integration/query.integration.test.d.ts.map +0 -1
  52. package/dist/__tests__/integration/query.integration.test.js +0 -118
  53. package/dist/__tests__/integration/suggester.integration.test.d.ts +0 -2
  54. package/dist/__tests__/integration/suggester.integration.test.d.ts.map +0 -1
  55. package/dist/__tests__/integration/suggester.integration.test.js +0 -48
  56. package/dist/__tests__/multi-search.test.d.ts +0 -2
  57. package/dist/__tests__/multi-search.test.d.ts.map +0 -1
  58. package/dist/__tests__/multi-search.test.js +0 -336
  59. package/dist/__tests__/query-builder.test.d.ts +0 -2
  60. package/dist/__tests__/query-builder.test.d.ts.map +0 -1
  61. package/dist/__tests__/query-builder.test.js +0 -5624
  62. package/dist/__tests__/suggester.test.d.ts +0 -2
  63. package/dist/__tests__/suggester.test.d.ts.map +0 -1
  64. package/dist/__tests__/suggester.test.js +0 -1001
@@ -1,55 +0,0 @@
1
- import { query, msearch, indexBuilder, keyword, integer } from '../../index.js';
2
- import { createIndex, deleteIndex, indexDoc, refreshIndex, msearchRequest } from './helpers.js';
3
- import { LISTINGS } from './fixtures/real-estate.js';
4
- const INDEX = 'int-msearch';
5
- describe('MSearchBuilder', () => {
6
- beforeAll(async () => {
7
- await createIndex(INDEX, indexBuilder()
8
- .mappings({
9
- address: 'text',
10
- property_class: keyword(),
11
- list_price: integer()
12
- })
13
- .build());
14
- for (const doc of LISTINGS)
15
- await indexDoc(INDEX, doc);
16
- await refreshIndex(INDEX);
17
- });
18
- afterAll(() => deleteIndex(INDEX));
19
- describe('Multi-search — basic', () => {
20
- it('executes two independent queries in one request', async () => {
21
- const result = await msearchRequest(INDEX, msearch()
22
- .addQuery(query().term('property_class', 'condo').build())
23
- .addQuery(query().term('property_class', 'townhouse').build())
24
- .build());
25
- expect(result.responses[0].hits.total.value).toBe(2);
26
- expect(result.responses[1].hits.total.value).toBe(2);
27
- });
28
- it('returns independent results per query', async () => {
29
- const result = await msearchRequest(INDEX, msearch()
30
- .addQuery(query().range('list_price', { lte: 2_000_000 }).build())
31
- .addQuery(query().range('list_price', { gte: 4_000_000 }).build())
32
- .build());
33
- expect(result.responses[0].hits.total.value).toBe(1);
34
- expect(result.responses[1].hits.total.value).toBe(1);
35
- });
36
- });
37
- describe('Multi-search — with aggregations', () => {
38
- it('each search can carry its own aggregation', async () => {
39
- const result = await msearchRequest(INDEX, msearch()
40
- .addQuery(query()
41
- .term('property_class', 'condo')
42
- .aggs((agg) => agg.avg('avg_price', 'list_price'))
43
- .size(0)
44
- .build())
45
- .addQuery(query()
46
- .term('property_class', 'townhouse')
47
- .aggs((agg) => agg.avg('avg_price', 'list_price'))
48
- .size(0)
49
- .build())
50
- .build());
51
- expect(result.responses[0].aggregations.avg_price.value).toBe(1_675_000);
52
- expect(result.responses[1].aggregations.avg_price.value).toBe(3_950_000);
53
- });
54
- });
55
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=query.integration.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/query.integration.test.ts"],"names":[],"mappings":""}
@@ -1,118 +0,0 @@
1
- import { query, indexBuilder, text, keyword, integer, float, date } from '../../index.js';
2
- import { createIndex, deleteIndex, indexDoc, refreshIndex, search } from './helpers.js';
3
- import { INSTRUMENTS } from './fixtures/finance.js';
4
- const INDEX = 'int-query';
5
- describe('QueryBuilder', () => {
6
- beforeAll(async () => {
7
- await createIndex(INDEX, indexBuilder()
8
- .mappings({
9
- name: text(),
10
- asset_class: keyword(),
11
- sector: keyword(),
12
- tags: keyword(),
13
- price: integer(),
14
- yield_rate: float(),
15
- active: 'boolean',
16
- listed_date: date()
17
- })
18
- .build());
19
- for (const doc of INSTRUMENTS)
20
- await indexDoc(INDEX, doc);
21
- await refreshIndex(INDEX);
22
- });
23
- afterAll(() => deleteIndex(INDEX));
24
- describe('Query — matchAll', () => {
25
- it('returns all documents', async () => {
26
- const result = await search(INDEX, query().matchAll().build());
27
- expect(result.hits.total.value).toBe(4);
28
- });
29
- it('respects size and from for pagination', async () => {
30
- const result = await search(INDEX, query().matchAll().size(2).from(1).build());
31
- expect(result.hits.hits.length).toBe(2);
32
- });
33
- });
34
- describe('Query — term and terms', () => {
35
- it('filters by a single term', async () => {
36
- const result = await search(INDEX, query().term('asset_class', 'equity').build());
37
- expect(result.hits.total.value).toBe(2);
38
- });
39
- it('filters by multiple terms', async () => {
40
- const result = await search(INDEX, query().terms('sector', ['government', 'corporate']).build());
41
- expect(result.hits.total.value).toBe(2);
42
- });
43
- });
44
- describe('Query — range', () => {
45
- it('filters documents within a numeric range', async () => {
46
- const result = await search(INDEX, query().range('price', { gte: 100, lte: 200 }).build());
47
- expect(result.hits.total.value).toBe(1);
48
- });
49
- it('filters documents by date range', async () => {
50
- const result = await search(INDEX, query().range('listed_date', { gte: '2023-01-01' }).build());
51
- expect(result.hits.total.value).toBe(2);
52
- });
53
- });
54
- describe('Query — bool', () => {
55
- it('combines must, mustNot, and filter clauses', async () => {
56
- const result = await search(INDEX, query()
57
- .bool()
58
- .must((q) => q.term('asset_class', 'fixed-income'))
59
- .mustNot((q) => q.term('sector', 'government'))
60
- .filter((q) => q.range('price', { lte: 200 }))
61
- .build());
62
- expect(result.hits.total.value).toBe(1);
63
- expect(result.hits.hits[0]._source.sector).toMatchInlineSnapshot(`"corporate"`);
64
- });
65
- });
66
- describe('Query — match and multiMatch', () => {
67
- it('performs full-text match on a text field', async () => {
68
- const result = await search(INDEX, query().match('name', 'Treasury').build());
69
- expect(result.hits.total.value).toBe(1);
70
- });
71
- it('searches across multiple fields with multiMatch', async () => {
72
- const result = await search(INDEX, query().multiMatch(['name', 'asset_class'], 'fund').build());
73
- expect(result.hits.total.value).toBe(2);
74
- });
75
- });
76
- describe('Query — sort and _source', () => {
77
- it('sorts results by a numeric field', async () => {
78
- const result = await search(INDEX, query().matchAll().sort('price', 'asc').build());
79
- const prices = result.hits.hits.map((h) => h._source.price);
80
- expect(prices).toMatchInlineSnapshot(`
81
- [
82
- 54,
83
- 98,
84
- 112,
85
- 479,
86
- ]
87
- `);
88
- });
89
- it('limits returned fields with _source', async () => {
90
- const result = await search(INDEX, query()
91
- .matchAll()
92
- .size(1)
93
- ._source(['name', 'price'])
94
- .build());
95
- const source = result.hits.hits[0]._source;
96
- expect(Object.keys(source).sort()).toMatchInlineSnapshot(`
97
- [
98
- "name",
99
- "price",
100
- ]
101
- `);
102
- });
103
- });
104
- describe('Query — exists and ids', () => {
105
- it('matches documents where a field exists', async () => {
106
- const result = await search(INDEX, query().exists('yield_rate').build());
107
- expect(result.hits.total.value).toBe(4);
108
- });
109
- it('retrieves documents by their ids', async () => {
110
- const all = await search(INDEX, query().matchAll().build());
111
- const ids = all.hits.hits
112
- .slice(0, 2)
113
- .map((h) => h._id);
114
- const result = await search(INDEX, query().ids(ids).build());
115
- expect(result.hits.total.value).toBe(2);
116
- });
117
- });
118
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=suggester.integration.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"suggester.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/suggester.integration.test.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- import { query, indexBuilder, keyword } from '../../index.js';
2
- import { createIndex, deleteIndex, indexDoc, refreshIndex, search } from './helpers.js';
3
- import { ATTORNEYS } from './fixtures/legal.js';
4
- const INDEX = 'int-suggester';
5
- describe('SuggesterBuilder', () => {
6
- beforeAll(async () => {
7
- await createIndex(INDEX, indexBuilder()
8
- .mappings({
9
- name: 'text',
10
- practice_area: keyword(),
11
- name_suggest: { type: 'completion' }
12
- })
13
- .build());
14
- for (const doc of ATTORNEYS)
15
- await indexDoc(INDEX, doc);
16
- await refreshIndex(INDEX);
17
- });
18
- afterAll(() => deleteIndex(INDEX));
19
- describe('Suggester — term', () => {
20
- it('returns spelling corrections for a misspelled term', async () => {
21
- const result = await search(INDEX, query()
22
- .suggest((s) => s.term('name-suggestions', 'wiliams', { field: 'name' }))
23
- .size(0)
24
- .build());
25
- expect(result.suggest['name-suggestions'][0].options.length).toBeGreaterThan(0);
26
- expect(result.suggest['name-suggestions'][0].options[0].text).toBe('williams');
27
- });
28
- });
29
- describe('Suggester — completion', () => {
30
- it('returns autocomplete suggestions for a prefix', async () => {
31
- const result = await search(INDEX, query()
32
- .suggest((s) => s.completion('autocomplete', 'kap', { field: 'name_suggest' }))
33
- .size(0)
34
- .build());
35
- const options = result.suggest.autocomplete[0].options;
36
- const texts = options.map((o) => o.text);
37
- expect(options.length).toBeGreaterThan(0);
38
- expect(texts.some((t) => t.toLowerCase().includes('kapoor'))).toBe(true);
39
- });
40
- it('limits results with size option', async () => {
41
- const result = await search(INDEX, query()
42
- .suggest((s) => s.completion('autocomplete', '', { field: 'name_suggest', size: 2 }))
43
- .size(0)
44
- .build());
45
- expect(result.suggest.autocomplete[0].options.length).toBeLessThanOrEqual(2);
46
- });
47
- });
48
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=multi-search.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"multi-search.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/multi-search.test.ts"],"names":[],"mappings":""}
@@ -1,336 +0,0 @@
1
- import { query, msearch } from '..';
2
- describe('Multi-Search API', () => {
3
- describe('add() method', () => {
4
- it('should add a raw MSearchRequest with header and body', () => {
5
- const body = query().matchAll().build();
6
- const result = msearch()
7
- .add({ header: { index: 'matters' }, body })
8
- .build();
9
- expect(result).toMatchInlineSnapshot(`
10
- "{"index":"matters"}
11
- {"query":{"match_all":{}}}
12
- "
13
- `);
14
- });
15
- it('should add a raw MSearchRequest without header', () => {
16
- const body = query().match('title', 'acquisition').build();
17
- const result = msearch().add({ body }).buildArray();
18
- expect(result).toMatchInlineSnapshot(`
19
- [
20
- {},
21
- {
22
- "query": {
23
- "match": {
24
- "title": "acquisition",
25
- },
26
- },
27
- },
28
- ]
29
- `);
30
- });
31
- });
32
- describe('Basic multi-search', () => {
33
- it('should build empty multi-search', () => {
34
- const result = msearch().build();
35
- expect(result).toBe('\n');
36
- });
37
- it('should build single search', () => {
38
- const q1 = query().match('title', 'acquisition').build();
39
- const result = msearch().addQuery(q1).build();
40
- expect(result).toMatchInlineSnapshot(`
41
- "{}
42
- {"query":{"match":{"title":"acquisition"}}}
43
- "
44
- `);
45
- });
46
- it('should build multiple searches', () => {
47
- const q1 = query().match('title', 'acquisition').build();
48
- const q2 = query().term('practice_area', 'corporate').build();
49
- const result = msearch().addQuery(q1).addQuery(q2).build();
50
- expect(result).toMatchInlineSnapshot(`
51
- "{}
52
- {"query":{"match":{"title":"acquisition"}}}
53
- {}
54
- {"query":{"term":{"practice_area":"corporate"}}}
55
- "
56
- `);
57
- });
58
- });
59
- describe('Multi-search with headers', () => {
60
- it('should add index to header', () => {
61
- const q1 = query().matchAll().build();
62
- const result = msearch()
63
- .addQuery(q1, { index: 'matters' })
64
- .build();
65
- expect(result).toMatchInlineSnapshot(`
66
- "{"index":"matters"}
67
- {"query":{"match_all":{}}}
68
- "
69
- `);
70
- });
71
- it('should add multiple indices', () => {
72
- const q1 = query().matchAll().build();
73
- const result = msearch()
74
- .addQuery(q1, { index: ['matters-1', 'matters-2'] })
75
- .build();
76
- expect(result).toMatchInlineSnapshot(`
77
- "{"index":["matters-1","matters-2"]}
78
- {"query":{"match_all":{}}}
79
- "
80
- `);
81
- });
82
- it('should add routing', () => {
83
- const q1 = query().matchAll().build();
84
- const result = msearch()
85
- .addQuery(q1, { routing: 'user-123' })
86
- .build();
87
- expect(result).toMatchInlineSnapshot(`
88
- "{"routing":"user-123"}
89
- {"query":{"match_all":{}}}
90
- "
91
- `);
92
- });
93
- it('should add preference', () => {
94
- const q1 = query().matchAll().build();
95
- const result = msearch()
96
- .addQuery(q1, { preference: '_local' })
97
- .build();
98
- expect(result).toMatchInlineSnapshot(`
99
- "{"preference":"_local"}
100
- {"query":{"match_all":{}}}
101
- "
102
- `);
103
- });
104
- it('should add search_type', () => {
105
- const q1 = query().matchAll().build();
106
- const result = msearch()
107
- .addQuery(q1, { search_type: 'dfs_query_then_fetch' })
108
- .build();
109
- expect(result).toMatchInlineSnapshot(`
110
- "{"search_type":"dfs_query_then_fetch"}
111
- {"query":{"match_all":{}}}
112
- "
113
- `);
114
- });
115
- it('should combine index and routing in header', () => {
116
- const q1 = query().matchAll().build();
117
- const result = msearch()
118
- .addQuery(q1, { index: 'matters', routing: 'tenant-1' })
119
- .buildArray();
120
- expect(result).toMatchInlineSnapshot(`
121
- [
122
- {
123
- "index": "matters",
124
- "routing": "tenant-1",
125
- },
126
- {
127
- "query": {
128
- "match_all": {},
129
- },
130
- },
131
- ]
132
- `);
133
- });
134
- it('should combine index and search_type in header', () => {
135
- const q1 = query().matchAll().build();
136
- const result = msearch()
137
- .addQuery(q1, {
138
- index: 'matters',
139
- search_type: 'dfs_query_then_fetch'
140
- })
141
- .buildArray();
142
- expect(result).toMatchInlineSnapshot(`
143
- [
144
- {
145
- "index": "matters",
146
- "search_type": "dfs_query_then_fetch",
147
- },
148
- {
149
- "query": {
150
- "match_all": {},
151
- },
152
- },
153
- ]
154
- `);
155
- });
156
- });
157
- describe('Multi-search output formats', () => {
158
- it('should build as NDJSON string', () => {
159
- const q1 = query().match('title', 'test').build();
160
- const result = msearch().addQuery(q1).build();
161
- expect(result).toMatchInlineSnapshot(`
162
- "{}
163
- {"query":{"match":{"title":"test"}}}
164
- "
165
- `);
166
- });
167
- it('should build as array', () => {
168
- const q1 = query().match('title', 'test').build();
169
- const result = msearch().addQuery(q1).buildArray();
170
- expect(result).toMatchInlineSnapshot(`
171
- [
172
- {},
173
- {
174
- "query": {
175
- "match": {
176
- "title": "test",
177
- },
178
- },
179
- },
180
- ]
181
- `);
182
- });
183
- it('should alternate headers and bodies in array', () => {
184
- const q1 = query().match('title', 'acquisition').build();
185
- const q2 = query().term('practice_area', 'corporate').build();
186
- const result = msearch()
187
- .addQuery(q1, { index: 'matters-1' })
188
- .addQuery(q2, { index: 'matters-2' })
189
- .buildArray();
190
- expect(result).toMatchInlineSnapshot(`
191
- [
192
- {
193
- "index": "matters-1",
194
- },
195
- {
196
- "query": {
197
- "match": {
198
- "title": "acquisition",
199
- },
200
- },
201
- },
202
- {
203
- "index": "matters-2",
204
- },
205
- {
206
- "query": {
207
- "term": {
208
- "practice_area": "corporate",
209
- },
210
- },
211
- },
212
- ]
213
- `);
214
- });
215
- });
216
- describe('Multi-search method chaining', () => {
217
- it('should support fluent chaining', () => {
218
- const q1 = query().match('title', 'acquisition').build();
219
- const q2 = query().term('practice_area', 'corporate').build();
220
- const q3 = query().range('billing_rate', { gte: 100 }).build();
221
- const result = msearch()
222
- .addQuery(q1, { index: 'matters' })
223
- .addQuery(q2, { index: 'matters' })
224
- .addQuery(q3, { index: 'matters' })
225
- .build();
226
- expect(result).toMatchInlineSnapshot(`
227
- "{"index":"matters"}
228
- {"query":{"match":{"title":"acquisition"}}}
229
- {"index":"matters"}
230
- {"query":{"term":{"practice_area":"corporate"}}}
231
- {"index":"matters"}
232
- {"query":{"range":{"billing_rate":{"gte":100}}}}
233
- "
234
- `);
235
- });
236
- });
237
- describe('Complex query bodies', () => {
238
- it('should addQuery with bool query including size and from', () => {
239
- const complexQuery = query()
240
- .bool()
241
- .must((q) => q.match('title', 'acquisition'))
242
- .filter((q) => q.range('billing_rate', { gte: 100, lte: 2000 }))
243
- .size(10)
244
- .from(0)
245
- .build();
246
- const result = msearch()
247
- .addQuery(complexQuery, { index: 'matters' })
248
- .buildArray();
249
- expect(result).toMatchInlineSnapshot(`
250
- [
251
- {
252
- "index": "matters",
253
- },
254
- {
255
- "from": 0,
256
- "query": {
257
- "bool": {
258
- "filter": [
259
- {
260
- "range": {
261
- "billing_rate": {
262
- "gte": 100,
263
- "lte": 2000,
264
- },
265
- },
266
- },
267
- ],
268
- "must": [
269
- {
270
- "match": {
271
- "title": "acquisition",
272
- },
273
- },
274
- ],
275
- },
276
- },
277
- "size": 10,
278
- },
279
- ]
280
- `);
281
- });
282
- });
283
- describe('Real-world multi-search scenarios', () => {
284
- it('should search across multiple indices', () => {
285
- const laptopQuery = query()
286
- .match('title', 'acquisition')
287
- .range('billing_rate', { gte: 500, lte: 2000 })
288
- .build();
289
- const phoneQuery = query()
290
- .match('title', 'compliance')
291
- .range('billing_rate', { gte: 300, lte: 1000 })
292
- .build();
293
- const result = msearch()
294
- .addQuery(laptopQuery, { index: 'matters' })
295
- .addQuery(phoneQuery, { index: 'matters' })
296
- .build();
297
- expect(result).toMatchInlineSnapshot(`
298
- "{"index":"matters"}
299
- {"query":{"range":{"billing_rate":{"gte":500,"lte":2000}}}}
300
- {"index":"matters"}
301
- {"query":{"range":{"billing_rate":{"gte":300,"lte":1000}}}}
302
- "
303
- `);
304
- });
305
- it('should search with different preferences', () => {
306
- const localQuery = query().matchAll().size(10).build();
307
- const primaryQuery = query().matchAll().size(20).build();
308
- const result = msearch()
309
- .addQuery(localQuery, { preference: '_local' })
310
- .addQuery(primaryQuery, { preference: '_primary' })
311
- .buildArray();
312
- expect(result).toMatchInlineSnapshot(`
313
- [
314
- {
315
- "preference": "_local",
316
- },
317
- {
318
- "query": {
319
- "match_all": {},
320
- },
321
- "size": 10,
322
- },
323
- {
324
- "preference": "_primary",
325
- },
326
- {
327
- "query": {
328
- "match_all": {},
329
- },
330
- "size": 20,
331
- },
332
- ]
333
- `);
334
- });
335
- });
336
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=query-builder.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query-builder.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/query-builder.test.ts"],"names":[],"mappings":""}