Created
January 21, 2015 16:17
-
-
Save nikravi/81dcef4b9a656c96ecd5 to your computer and use it in GitHub Desktop.
ES query snippets
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 videos/episode/_search | |
{ | |
"size": 20, | |
"query": { | |
"query_string": { | |
"query": "summer" | |
} | |
} | |
} | |
//query for any text inside a field | |
//return only part of the json (_source) | |
GET videos/episode/_search | |
{ | |
"size": 20, | |
"query": { | |
"query_string": { | |
"query": "*", | |
"fields": [ | |
"rights.territory.type"] | |
} | |
}, | |
"_source": ["restrictions", "rights"] | |
} | |
//query for missing fields, like null, or non-existent fields. | |
GET videos/episode/_search | |
{ | |
"size": 10, | |
"query": { | |
"filtered": { | |
"filter": { | |
"missing": { | |
"field": "rights.ownership" | |
} | |
} | |
} | |
}, | |
"_source": [ "restrictions", "rights"] | |
} | |
//query by id | |
GET videos/episode/_search | |
{ | |
"size": 20, | |
"query": { | |
"query_string": { | |
"query": 10620, | |
"fields": [ | |
"ids.scrid" | |
] | |
} | |
}, | |
"_source": [ "restrictions", "rights"] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment