Last active
December 16, 2018 10:59
-
-
Save prashanth-sams/0c452baff6d2d46ea0910a548bc51738 to your computer and use it in GitHub Desktop.
Elastic search queries with condition
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
| GET /your_path/_search | |
| { | |
| "size": 5, | |
| "_source": [ "expected_key1", "expected_key2", "..."], | |
| "query": { | |
| "bool": { | |
| "should": [ | |
| { | |
| "term": { | |
| "expected_key": expected_value | |
| } | |
| }, | |
| { | |
| "term": { | |
| "expected_key": expected_value | |
| } | |
| } | |
| ] | |
| } | |
| } | |
| } |
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
| GET /your_path/_search | |
| { | |
| "size": 5, | |
| "_source":["expected_key1","expected_key2", "..."], | |
| "query": { | |
| "bool": { | |
| "must_not": [ | |
| { | |
| "term": { | |
| "expected_key": expected_value | |
| } | |
| } | |
| ], | |
| "should": [ | |
| { | |
| "term": { | |
| "expected_key": expected_value | |
| } | |
| } | |
| ] | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment