Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch: How to use filter_path parameter in POST body

So I can successfully do request like:

localhost:9200/filebeat-*/_count?filter_path=-_shards
{"query": {
    "match_phrase" : {
        "message" : "o hohoho"
    }
 }}

How I can move filter_path=-_shards into the request body to make it work?

like image 846
pbaranski Avatar asked Jun 16 '17 06:06

pbaranski


Video Answer


1 Answers

According to the documentation code, still not possible in Elasticsearch 6.2:

All REST APIs accept a filter_path parameter that can be used to reduce the response returned by Elasticsearch

and it's impossible to include it into the request body, that's just not supported (to be honest, I'm not sure if it will ever be supported).

However, for some scenarios, you could limit response returned by Elasticsearch by using source filtering (unfortunately, it's only applicable to returned fields of documents)

like image 130
Mysterion Avatar answered Sep 28 '22 04:09

Mysterion