Last active
May 17, 2017 09:26
-
-
Save razorcd/47b7b90fa0709f03263aafc7e5ab0f81 to your computer and use it in GitHub Desktop.
Contracts based on a range intersection where validTo can be null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 9999999, | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"nested": { | |
"path": "contractAttributions", | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"terms": { | |
"contractAttributions.contractNumber": ["UBI00000094-0003", "UBI00000094-0005"] | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"nested": { | |
"path": "contractAttributions", | |
"filter": { | |
"bool": { | |
"must": [ | |
{ | |
"range": { | |
"contractAttributions.validFrom": { | |
"lte": "2017-01-01T00:00:00.000+01:00" | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
}, | |
{ | |
"nested": { | |
"path": "contractAttributions", | |
"filter": { | |
"bool": { | |
"should": [ | |
{ | |
"range": { | |
"contractAttributions.validTo": { | |
"gte": "2015-03-30T00:00:00.000+01:00" | |
} | |
} | |
}, | |
{ | |
"missing": { | |
"field": "contractAttributions.validTo" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment