Problem with Java API callbacks

Hi,

I found out that when using the Java API on index, i.e:
client.index(..., new ActionListener()...)

then my callback's onSuccess() method is called BEFORE the document is accessible in the index. I search for the document immediately after onSuccess() has been called, and receive an older version than what was just indexed.

Any ideas?

Thanks!

Hi,

You mean you search for the document using the same client instance which is
used to index the document in the onResponse() method of ActionListener?

Something like:
Client myclient = new NodeClient();
myclient.index( ..., new ActionListener() { onResponse() { myclient.search()
} } )

Regards,
Lukas

On Thu, Jun 10, 2010 at 2:59 PM, Lenak lenakovganov@gmail.com wrote:

Hi,

I found out that when using the Java API on index, i.e:
client.index(..., new ActionListener()...)

then my callback's onSuccess() method is called BEFORE the document is
accessible in the index. I search for the document immediately after
onSuccess() has been called, and receive an older version than what was
just
indexed.

Any ideas?

Thanks!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Problem-with-Java-API-callbacks-tp885464p885464.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

yes, exactly like you described.
You think there a problem working this way?

On Thu, Jun 10, 2010 at 5:23 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

You mean you search for the document using the same client instance which
is used to index the document in the onResponse() method of ActionListener?

Something like:
Client myclient = new NodeClient();
myclient.index( ..., new ActionListener() { onResponse() {
myclient.search() } } )

Regards,
Lukas

On Thu, Jun 10, 2010 at 2:59 PM, Lenak lenakovganov@gmail.com wrote:

Hi,

I found out that when using the Java API on index, i.e:
client.index(..., new ActionListener()...)

then my callback's onSuccess() method is called BEFORE the document is
accessible in the index. I search for the document immediately after
onSuccess() has been called, and receive an older version than what was
just
indexed.

Any ideas?

Thanks!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Problem-with-Java-API-callbacks-tp885464p885464.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

You can certainly work like that. Elasticsearch provides near real time
search support, this means that search / get requests will only "see"
indexed documents after an interval (which can be configured). There is an
API called refresh that makes all indexable documented visible for search.

Note, refresh is not a lightweight operation, and can affect indexing
performance.

-shay.banon

On Thu, Jun 10, 2010 at 5:42 PM, Lena Kovganov lenakovganov@gmail.comwrote:

yes, exactly like you described.
You think there a problem working this way?

On Thu, Jun 10, 2010 at 5:23 PM, Lukáš Vlček lukas.vlcek@gmail.comwrote:

Hi,

You mean you search for the document using the same client instance which
is used to index the document in the onResponse() method of ActionListener?

Something like:
Client myclient = new NodeClient();
myclient.index( ..., new ActionListener() { onResponse() {
myclient.search() } } )

Regards,
Lukas

On Thu, Jun 10, 2010 at 2:59 PM, Lenak lenakovganov@gmail.com wrote:

Hi,

I found out that when using the Java API on index, i.e:
client.index(..., new ActionListener()...)

then my callback's onSuccess() method is called BEFORE the document is
accessible in the index. I search for the document immediately after
onSuccess() has been called, and receive an older version than what was
just
indexed.

Any ideas?

Thanks!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Problem-with-Java-API-callbacks-tp885464p885464.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

[This is the original poster]
1. The thing is I wish to know the exact point in runtime when the document can be seen in index. That's why I use the ActionListener.
The reason for this is that pending index requests are dependent on the current index operation to finish (and for the document to be accessible).

2. where is that interval configured ?

Thanks,
Amit