@@ -62,6 +62,19 @@ setup:
62
62
id : 7
63
63
body :
64
64
my_field : " ABCD"
65
+ - do :
66
+ index :
67
+ index : test
68
+ id : 8
69
+ body :
70
+ my_field : " *"
71
+
72
+ - do :
73
+ index :
74
+ index : test
75
+ id : 9
76
+ body :
77
+ my_field : " \\ *"
65
78
- do :
66
79
indices.refresh : {}
67
80
@@ -223,7 +236,7 @@ setup:
223
236
wildcard :
224
237
my_field :
225
238
value : " *"
226
- - match : { hits.total.value: 6 }
239
+ - match : { hits.total.value: 8 }
227
240
---
228
241
" regexp match-all works " :
229
242
- do :
@@ -234,7 +247,7 @@ setup:
234
247
regexp :
235
248
my_field :
236
249
value : " .*"
237
- - match : { hits.total.value: 6 }
250
+ - match : { hits.total.value: 8 }
238
251
---
239
252
" terms query on wildcard field matches " :
240
253
- do :
@@ -270,3 +283,113 @@ setup:
270
283
- match : { hits.total.value: 2 }
271
284
- match : { hits.hits.0._id: "5" }
272
285
- match : { hits.hits.1._id: "7" }
286
+ ---
287
+ " case insensitive regexp query on wildcard field " :
288
+ - do :
289
+ search :
290
+ index : test
291
+ body :
292
+ query :
293
+ regexp :
294
+ my_field :
295
+ value : " AbCd"
296
+ - match : { hits.total.value: 1 }
297
+ - match : { hits.hits.0._id: "5" }
298
+ - do :
299
+ search :
300
+ index : test
301
+ body :
302
+ query :
303
+ regexp :
304
+ my_field :
305
+ value : " AbCd"
306
+ case_insensitive : true
307
+ - match : { hits.total.value: 2 }
308
+ - match : { hits.hits.0._id: "5" }
309
+ - match : { hits.hits.1._id: "7" }
310
+ ---
311
+ " wildcard query works on values contains escaped characters " :
312
+ - do :
313
+ search :
314
+ index : test
315
+ body :
316
+ query :
317
+ wildcard :
318
+ my_field :
319
+ value : " \\ *"
320
+ - match : { hits.total.value: 1 }
321
+ - match : { hits.hits.0._id: "8" }
322
+
323
+ - do :
324
+ search :
325
+ index : test
326
+ body :
327
+ query :
328
+ wildcard :
329
+ my_field :
330
+ value : " \\\\\\ *"
331
+ - match : { hits.total.value: 1 }
332
+ - match : { hits.hits.0._id: "9" }
333
+ ---
334
+ " regexp query works on values contains escaped characters " :
335
+ - do :
336
+ search :
337
+ index : test
338
+ body :
339
+ query :
340
+ regexp :
341
+ my_field :
342
+ value : " \\ *"
343
+ - match : { hits.total.value: 1 }
344
+ - match : { hits.hits.0._id: "8" }
345
+
346
+ - do :
347
+ search :
348
+ index : test
349
+ body :
350
+ query :
351
+ regexp :
352
+ my_field :
353
+ value : " \\\\\\ *"
354
+ - match : { hits.total.value: 1 }
355
+ - match : { hits.hits.0._id: "9"}
356
+ ---
357
+ " term query contains escaped characters " :
358
+ - do :
359
+ search :
360
+ index : test
361
+ body :
362
+ query :
363
+ term :
364
+ my_field : " \\ *"
365
+ - match : { hits.total.value: 1 }
366
+ - match : { hits.hits.0._id: "9" }
367
+
368
+ - do :
369
+ search :
370
+ index : test
371
+ body :
372
+ query :
373
+ term :
374
+ my_field : " *"
375
+ - match : { hits.total.value: 1 }
376
+ - match : { hits.hits.0._id: "8"}
377
+ ---
378
+ " terms query contains escaped characters " :
379
+ - do :
380
+ search :
381
+ index : test
382
+ body :
383
+ query :
384
+ terms : { my_field: ["*"] }
385
+ - match : { hits.total.value: 1 }
386
+ - match : { hits.hits.0._id: "8" }
387
+
388
+ - do :
389
+ search :
390
+ index : test
391
+ body :
392
+ query :
393
+ terms : { my_field: [ "\\*" ] }
394
+ - match : { hits.total.value: 1 }
395
+ - match : { hits.hits.0._id: "9" }
0 commit comments