Reputation: 9825
My indexed Elasticsearch documents include many fields. I've been using match_all query to get results. There are a few fields I'd like to exclude from match_all, is this possible?
Upvotes: 2
Views: 5131
Reputation: 345
For this question I will give you the example
GET index_name/index_type/_search
{
"_source": {
"exclude": [
]
},
"query": {
"match_all": {}
}
}
Upvotes: 1
Reputation: 17049
With ElasticSearch 2.x, you can use source filtering, example:
{
"_source": {
"include": [ "obj1.*", "obj2.*" ],
"exclude": [ "*.description" ]
},
"query" : {
"term" : { "user" : "kimchy" }
}
}
For a GET request you may also pass it via the url.
Upvotes: 0