File tree Expand file tree Collapse file tree 3 files changed +221
-8
lines changed
es6/rest/src/main/scala/app/softnetwork/elastic/client/rest
es7/rest/src/main/scala/app/softnetwork/elastic/client/rest Expand file tree Collapse file tree 3 files changed +221
-8
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,219 @@ val sqlQuery = """
252252val results = client.search(SQLQuery (sqlQuery))
253253```
254254
255+ ``` json
256+ {
257+ "query" : {
258+ "bool" : {
259+ "filter" : [
260+ {
261+ "bool" : {
262+ "filter" : [
263+ {
264+ "exists" : {
265+ "field" : " firstName"
266+ }
267+ },
268+ {
269+ "exists" : {
270+ "field" : " lastName"
271+ }
272+ },
273+ {
274+ "exists" : {
275+ "field" : " description"
276+ }
277+ },
278+ {
279+ "range" : {
280+ "preparationTime" : {
281+ "lte" : 120
282+ }
283+ }
284+ },
285+ {
286+ "term" : {
287+ "deliveryPeriods.dayOfWeek" : {
288+ "value" : 6
289+ }
290+ }
291+ },
292+ {
293+ "bool" : {
294+ "must_not" : [
295+ {
296+ "regexp" : {
297+ "blockedCustomers" : {
298+ "value" : " .*uuid.*"
299+ }
300+ }
301+ }
302+ ]
303+ }
304+ },
305+ {
306+ "bool" : {
307+ "must_not" : [
308+ {
309+ "term" : {
310+ "receiptOfOrdersDisabled" : {
311+ "value" : true
312+ }
313+ }
314+ }
315+ ]
316+ }
317+ },
318+ {
319+ "bool" : {
320+ "should" : [
321+ {
322+ "geo_distance" : {
323+ "distance" : " 7000m" ,
324+ "pickup.location" : [
325+ 0.0 ,
326+ 0.0
327+ ]
328+ }
329+ },
330+ {
331+ "geo_distance" : {
332+ "distance" : " 7000m" ,
333+ "withdrawals.location" : [
334+ 0.0 ,
335+ 0.0
336+ ]
337+ }
338+ }
339+ ]
340+ }
341+ }
342+ ]
343+ }
344+ }
345+ ]
346+ }
347+ },
348+ "size" : 0 ,
349+ "min_score" : 1.0 ,
350+ "_source" : true ,
351+ "aggs" : {
352+ "inner_products" : {
353+ "nested" : {
354+ "path" : " products"
355+ },
356+ "aggs" : {
357+ "filtered_inner_products" : {
358+ "filter" : {
359+ "bool" : {
360+ "filter" : [
361+ {
362+ "bool" : {
363+ "must_not" : [
364+ {
365+ "term" : {
366+ "products.category" : {
367+ "value" : " coffee"
368+ }
369+ }
370+ }
371+ ]
372+ }
373+ },
374+ {
375+ "match_all" : {}
376+ },
377+ {
378+ "match_all" : {}
379+ },
380+ {
381+ "bool" : {
382+ "should" : [
383+ {
384+ "match" : {
385+ "products.name" : {
386+ "query" : " lasagnes"
387+ }
388+ }
389+ },
390+ {
391+ "match" : {
392+ "products.description" : {
393+ "query" : " lasagnes"
394+ }
395+ }
396+ },
397+ {
398+ "match" : {
399+ "products.ingredients" : {
400+ "query" : " lasagnes"
401+ }
402+ }
403+ }
404+ ]
405+ }
406+ },
407+ {
408+ "range" : {
409+ "products.stock" : {
410+ "gt" : 0
411+ }
412+ }
413+ },
414+ {
415+ "term" : {
416+ "products.upForSale" : {
417+ "value" : true
418+ }
419+ }
420+ },
421+ {
422+ "term" : {
423+ "products.deleted" : {
424+ "value" : false
425+ }
426+ }
427+ }
428+ ]
429+ }
430+ },
431+ "aggs" : {
432+ "cat" : {
433+ "terms" : {
434+ "field" : " products.category.keyword"
435+ },
436+ "aggs" : {
437+ "min_price" : {
438+ "min" : {
439+ "field" : " products.price"
440+ }
441+ },
442+ "max_price" : {
443+ "max" : {
444+ "field" : " products.price"
445+ }
446+ },
447+ "having_filter" : {
448+ "bucket_selector" : {
449+ "buckets_path" : {
450+ "min_price" : " inner_products>min_price" ,
451+ "max_price" : " inner_products>max_price"
452+ },
453+ "script" : {
454+ "source" : " params.min_price > 5.0 && params.max_price < 50.0"
455+ }
456+ }
457+ }
458+ }
459+ }
460+ }
461+ }
462+ }
463+ }
464+ }
465+ }
466+ ```
467+
255468📖 ** [ Full SQL Documentation] ( documentation/sql/README.md ) **
256469
257470---
Original file line number Diff line number Diff line change @@ -581,8 +581,8 @@ trait RestHighLevelClientUpdateApi extends UpdateApi with RestHighLevelClientHel
581581 )(
582582 transformer = resp =>
583583 resp.getResult match {
584- case DocWriteResponse .Result .CREATED |
585- DocWriteResponse .Result .UPDATED | DocWriteResponse . Result . NOOP =>
584+ case DocWriteResponse .Result .CREATED | DocWriteResponse . Result . UPDATED |
585+ DocWriteResponse .Result .NOOP =>
586586 true
587587 case DocWriteResponse .Result .NOT_FOUND =>
588588 throw new IOException (
@@ -615,8 +615,8 @@ trait RestHighLevelClientUpdateApi extends UpdateApi with RestHighLevelClientHel
615615 )(
616616 transformer = resp =>
617617 resp.getResult match {
618- case DocWriteResponse .Result .CREATED |
619- DocWriteResponse .Result .UPDATED | DocWriteResponse . Result . NOOP =>
618+ case DocWriteResponse .Result .CREATED | DocWriteResponse . Result . UPDATED |
619+ DocWriteResponse .Result .NOOP =>
620620 true
621621 case DocWriteResponse .Result .NOT_FOUND =>
622622 throw new IOException (
Original file line number Diff line number Diff line change @@ -585,8 +585,8 @@ trait RestHighLevelClientUpdateApi extends UpdateApi with RestHighLevelClientHel
585585 )(
586586 transformer = resp =>
587587 resp.getResult match {
588- case DocWriteResponse .Result .CREATED |
589- DocWriteResponse .Result .UPDATED | DocWriteResponse . Result . NOOP =>
588+ case DocWriteResponse .Result .CREATED | DocWriteResponse . Result . UPDATED |
589+ DocWriteResponse .Result .NOOP =>
590590 true
591591 case DocWriteResponse .Result .NOT_FOUND =>
592592 throw new IOException (
@@ -619,8 +619,8 @@ trait RestHighLevelClientUpdateApi extends UpdateApi with RestHighLevelClientHel
619619 )(
620620 transformer = resp =>
621621 resp.getResult match {
622- case DocWriteResponse .Result .CREATED |
623- DocWriteResponse .Result .UPDATED | DocWriteResponse . Result . NOOP =>
622+ case DocWriteResponse .Result .CREATED | DocWriteResponse . Result . UPDATED |
623+ DocWriteResponse .Result .NOOP =>
624624 true
625625 case DocWriteResponse .Result .NOT_FOUND =>
626626 throw new IOException (
You can’t perform that action at this time.
0 commit comments