Skip to content

Commit a47eb96

Browse files
committed
fix nullable, update painless signature
1 parent 39ed145 commit a47eb96

File tree

17 files changed

+395
-317
lines changed

17 files changed

+395
-317
lines changed

es6/sql-bridge/src/test/scala/app/softnetwork/elastic/sql/SQLCriteriaSpec.scala

Lines changed: 113 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -413,80 +413,84 @@ class SQLCriteriaSpec extends AnyFlatSpec with Matchers {
413413
}
414414

415415
it should "filter nested predicate" in {
416-
asQuery(nestedPredicate) shouldBe """{
417-
418-
|"query":{
419-
| "bool":{
420-
| "filter" : [
421-
| {
422-
| "term" : {
423-
| "identifier1" : {
424-
| "value" : 1
425-
| }
426-
| }
427-
| },
428-
| {
429-
| "nested" : {
430-
| "path" : "nested",
431-
| "query" : {
432-
| "bool" : {
433-
| "should" : [
434-
| {
435-
| "range" : {
436-
| "nested.identifier2" : {
437-
| "gt" : 2
438-
| }
439-
| }
440-
| },
441-
| {
442-
| "term" : {
443-
| "nested.identifier3" : {
444-
| "value" : 3
445-
| }
446-
| }
447-
| }
448-
| ]
449-
| }
450-
| },
451-
| "inner_hits":{"name":"nested","from":0,"size":3}
452-
| }
453-
| }
454-
| ]
455-
| }
456-
| }
457-
|}""".stripMargin.replaceAll("\\s", "")
416+
asQuery(nestedPredicate) shouldBe
417+
"""{
418+
| "query": {
419+
| "bool": {
420+
| "filter": [
421+
| {
422+
| "term": {
423+
| "identifier1": {
424+
| "value": 1
425+
| }
426+
| }
427+
| },
428+
| {
429+
| "nested": {
430+
| "path": "nested",
431+
| "query": {
432+
| "bool": {
433+
| "should": [
434+
| {
435+
| "range": {
436+
| "nested.identifier2": {
437+
| "gt": 2
438+
| }
439+
| }
440+
| },
441+
| {
442+
| "term": {
443+
| "nested.identifier3": {
444+
| "value": 3
445+
| }
446+
| }
447+
| }
448+
| ]
449+
| }
450+
| },
451+
| "inner_hits": {
452+
| "name": "nested"
453+
| }
454+
| }
455+
| }
456+
| ]
457+
| }
458+
| }
459+
|}""".stripMargin.replaceAll("\\s", "")
458460
}
459461

460462
it should "filter nested criteria" in {
461-
asQuery(nestedCriteria) shouldBe """{
462-
463-
|"query":{
464-
| "bool":{
465-
| "filter" : [
466-
| {
467-
| "term" : {
468-
| "identifier1" : {
469-
| "value" : 1
470-
| }
471-
| }
472-
| },
473-
| {
474-
| "nested" : {
475-
| "path" : "nested",
476-
| "query" : {
477-
| "term" : {
478-
| "nested.identifier3" : {
479-
| "value" : 3
480-
| }
481-
| }
482-
| },
483-
| "inner_hits":{"name":"nested","from":0,"size":3}
484-
| }
485-
| }
486-
| ]
487-
| }
488-
| }
489-
|}""".stripMargin.replaceAll("\\s", "")
463+
asQuery(nestedCriteria) shouldBe
464+
"""{
465+
| "query": {
466+
| "bool": {
467+
| "filter": [
468+
| {
469+
| "term": {
470+
| "identifier1": {
471+
| "value": 1
472+
| }
473+
| }
474+
| },
475+
| {
476+
| "nested": {
477+
| "path": "nested",
478+
| "query": {
479+
| "term": {
480+
| "nested.identifier3": {
481+
| "value": 3
482+
| }
483+
| }
484+
| },
485+
| "inner_hits": {
486+
| "name": "nested"
487+
| }
488+
| }
489+
| }
490+
| ]
491+
| }
492+
| }
493+
|}""".stripMargin.replaceAll("\\s", "")
490494
}
491495

492496
it should "filter child predicate" in {
@@ -670,36 +674,44 @@ class SQLCriteriaSpec extends AnyFlatSpec with Matchers {
670674
}
671675

672676
it should "filter nested with between" in {
673-
asQuery(nestedWithBetween) shouldBe """{
674-
675-
|"query":{
676-
| "bool":{"filter":[{"nested" : {
677-
| "path" : "ciblage",
678-
| "query" : {
679-
| "bool" : {
680-
| "filter" : [
681-
| {
682-
| "range" : {
683-
| "ciblage.Archivage_CreationDate" : {
684-
| "gte" : "NOW-3M/M",
685-
| "lte" : "NOW"
686-
| }
687-
| }
688-
| },
689-
| {
690-
| "term" : {
691-
| "ciblage.statutComportement" : {
692-
| "value" : 1
693-
| }
694-
| }
695-
| }
696-
| ]
697-
| }
698-
| },
699-
| "inner_hits":{"name":"ciblage","from":0,"size":3}
700-
| }
701-
| }
702-
|]}}}""".stripMargin.replaceAll("\\s", "")
677+
asQuery(nestedWithBetween) shouldBe
678+
"""{
679+
| "query": {
680+
| "bool": {
681+
| "filter": [
682+
| {
683+
| "nested": {
684+
| "path": "ciblage",
685+
| "query": {
686+
| "bool": {
687+
| "filter": [
688+
| {
689+
| "range": {
690+
| "ciblage.Archivage_CreationDate": {
691+
| "gte": "now-3M/M",
692+
| "lte": "now"
693+
| }
694+
| }
695+
| },
696+
| {
697+
| "term": {
698+
| "ciblage.statutComportement": {
699+
| "value": 1
700+
| }
701+
| }
702+
| }
703+
| ]
704+
| }
705+
| },
706+
| "inner_hits": {
707+
| "name": "ciblage"
708+
| }
709+
| }
710+
| }
711+
| ]
712+
| }
713+
| }
714+
|}""".stripMargin.replaceAll("\\s", "")
703715
}
704716

705717
it should "filter boolean eq" in {

0 commit comments

Comments
 (0)