Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Empty post_filter results in json array in stead of object

Open remibaar opened this issue 10 years ago • 1 comments

If something empty is set to the post_filter (e.g. empty Bool Filter), the post_field is added to the request body as an empty array.

$query = new \Elastica\Query();
$query->setPostFilter(new \Elastica\Filter\BoolFilter());

Results in:

{
  "post_filter": [],
  "query": {
    "match_all": {}
  }
}

But has to be:

{
  "post_filter": {},
  "query": {
    "match_all": {}
  }
}

remibaar avatar Jan 05 '16 14:01 remibaar

Seems like a array instead of stdin object issue. Could you open a PR to fix this?

ruflin avatar Jan 05 '16 21:01 ruflin