elasticsearch-query-builder icon indicating copy to clipboard operation
elasticsearch-query-builder copied to clipboard

Fix: Add return for size and from at getPayload

Open harlequin410 opened this issue 1 year ago • 0 comments

Add support for returning the size and from at getPayload.

Since size and from could be 0 e.g. when just using aggregations or on page 1. Check if var is nut null.

Tested and working with this example query: $builder->index('test_*') ->size(1000) ->from(0) ->addQuery(TermQuery::create('id', $id),'filter') ->addQuery(RangeQuery::create('@timestamp') ->gte("now-24h") ->lte("now") );

Workaround for this could be: $query = array_merge(array('size' => 1000), $builder->getPayload()); $query = array_merge(array('from' => 0), $query));

harlequin410 avatar Feb 22 '24 08:02 harlequin410