Created
May 18, 2017 19:32
-
-
Save hpainter/47024bab3a8dd0ac260a04965c6d5be8 to your computer and use it in GitHub Desktop.
es query demo
This file contains hidden or 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
query.bool.filter.push({ | |
"bool": { | |
// top-level status term group...doc must match one of these 'shoulds' | |
"should": [ | |
// Available status | |
{ | |
"bool": { | |
"must": [ | |
{"term": { "status": "Available"}}, | |
{"bool": { "should": [ | |
// user created appt | |
{"term": { "creator_id": req.user.id }}, | |
// user is specialist in originator private ntwk (include dynamically) | |
{"term": { "originator_id": req.user.person.organizations.map( (o) => o.id ) } } | |
] } } | |
] | |
} | |
}, | |
// Claimed status | |
// ... | |
// Not one of the above statuses | |
{"bool": {"must_not": ["Available","Claimed","..."]}} | |
] | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment