Range query in unit test

Hi,

I've just started to play with elasticsearch and I wanted to write
basic java unit tests for testing the core functionality of
elasticsearch.
I created a local node with nodebuilder
(nodeBuilder().local(true).settings(settings).node()) for my unit
tests and inserted some test data into it and I wanted to test the
query functionalities, how it is work.
At every insert function I set the refresh(true) property and most of
the queries worked fine from unit test (query for field, wildcard
queries, etc...) right after the insertion.
However when I searched with a queryString which contained a
rangeQuery (for date) then it most of the times returned with empty
resultset and sometimes it returned with the correct resultset.
When I started to play with the different settings then I found out,
if I force elasticsearch to flush data then rangeQuery always gave me
back the correct resultset.

I'm wondering why this happened and why just range queries were
affected.
Can anybody explain me, why this happened?

Thanks,
Tamas

Can you gist your sample code?

On Wednesday, June 8, 2011 at 12:28 PM, Tamás wrote:

Hi,

I've just started to play with elasticsearch and I wanted to write
basic java unit tests for testing the core functionality of
elasticsearch.
I created a local node with nodebuilder
(nodeBuilder().local(true).settings(settings).node()) for my unit
tests and inserted some test data into it and I wanted to test the
query functionalities, how it is work.
At every insert function I set the refresh(true) property and most of
the queries worked fine from unit test (query for field, wildcard
queries, etc...) right after the insertion.
However when I searched with a queryString which contained a
rangeQuery (for date) then it most of the times returned with empty
resultset and sometimes it returned with the correct resultset.
When I started to play with the different settings then I found out,
if I force elasticsearch to flush data then rangeQuery always gave me
back the correct resultset.

I'm wondering why this happened and why just range queries were
affected.
Can anybody explain me, why this happened?

Thanks,
Tamas

  • deleted -