Skip to content

Instantly share code, notes, and snippets.

@geekpete
Created December 15, 2016 01:04
Show Gist options
  • Save geekpete/29ebc8dc57873eaecf86b039fe71ab6b to your computer and use it in GitHub Desktop.
Save geekpete/29ebc8dc57873eaecf86b039fe71ab6b to your computer and use it in GitHub Desktop.
source filtering and filter_path
GET /birthday/_search
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "birthday",
"_type": "t",
"_id": "1",
"_score": 1,
"_source": {
"birthday": "1974-05-04",
"first_name": "foo",
"last_name": "bar",
"hobby": "baz"
}
}
]
}
}
# using both filter_path and source filtering
GET /birthday/_search?_source_include=birthday&filter_path=hits.hits._source.birthday
{
"hits": {
"hits": [
{
"_source": {
"birthday": "1974-05-04"
}
}
]
}
}
# using only filter_path and without source filtering
{
"hits": {
"hits": [
{
"_source": {
"birthday": "1974-05-04"
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment