Skip to content

Instantly share code, notes, and snippets.

@razorcd
Last active May 17, 2017 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razorcd/47b7b90fa0709f03263aafc7e5ab0f81 to your computer and use it in GitHub Desktop.
Save razorcd/47b7b90fa0709f03263aafc7e5ab0f81 to your computer and use it in GitHub Desktop.
Contracts based on a range intersection where validTo can be null
{
"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