elasticsearch - Elastic Search - exclude index and type from json response -
when execute query on index this:
{ "_source":["bar"] , "size":100, "query": { "match_all": {} }, "filter": { "type" : { "value" : "foo" } } }
the response includes index, type, etc. know index , type because specified it. information bloats size of json data. there way exclude these response?
this get:
{ "took": 31, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 364024, "max_score": 1, "hits": [ { "_index": "foo_bar", "_type": "foo", "_id": "asdjj123123", "_score": 1, "_source": { "bar": "blablablabla" } } ,...
what want this, response without type,score,index:
{ "took": 31, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 364024, "max_score": 1, "hits": [ { "_id": "asdjj123123", "_source": { "bar": "blablablabla" } } ,...
yes, of es 1.6, can use response filtering , using filter_path
parameter in query enumerate need in response:
curl -xget 'localhost:9200/foo_bar/foo/_search?pretty&filter_path=hits.total,hits.max_score,hits.hits._id,hits.hits._source'
Comments
Post a Comment