Stale data retuned after index request

Hey,

I am probably just missing something obvious, but I am getting stale data
when searching right after the index update:

Settings settings = 
ImmutableSettings.settingsBuilder().put("client.transport.sniff", 
true).build();
TransportClient client = new 
TransportClient(settings).addTransportAddress(new 
InetSocketTransportAddress(host, port));
IndexResponse indexResponse = client.index(source).actionGet();
client.setQuery(matchAllQuery()).execute().get();

I thought index operation was synchronous? If I add a tiny delay between
the index and search operations, the updated data is being returned. I only
have a single node, no replication, with default settings. Can anyone point
me to the right direction here please?

regards,
Andrius Juozapaitis

Updates become available after index refresh. Refresh can be triggered
manually (see
Elasticsearch Platform — Find real-time answers at scale | Elastic)
or it can be scheduled to run periodically (see index.refresh_interval in
Elasticsearch Platform — Find real-time answers at scale | Elastic)

On Sunday, April 15, 2012 6:08:01 PM UTC-4, Andrius Juozapaitis wrote:

Hey,

I am probably just missing something obvious, but I am getting stale data
when searching right after the index update:

Settings settings = 
> ImmutableSettings.settingsBuilder().put("client.transport.sniff", 
> true).build();
> TransportClient client = new 
> TransportClient(settings).addTransportAddress(new 
> InetSocketTransportAddress(host, port));
> IndexResponse indexResponse = client.index(source).actionGet();
> client.setQuery(matchAllQuery()).execute().get();

I thought index operation was synchronous? If I add a tiny delay between
the index and search operations, the updated data is being returned. I only
have a single node, no replication, with default settings. Can anyone point
me to the right direction here please?

regards,
Andrius Juozapaitis

Thanks Igor, much appreciated!

regards,
Andrius

On Monday, April 16, 2012 4:41:11 PM UTC+3, Igor Motov wrote:

Updates become available after index refresh. Refresh can be triggered
manually (see
Elasticsearch Platform — Find real-time answers at scale | Elastic)
or it can be scheduled to run periodically (see index.refresh_interval in
Elasticsearch Platform — Find real-time answers at scale | Elastic)

On Sunday, April 15, 2012 6:08:01 PM UTC-4, Andrius Juozapaitis wrote:

Hey,

I am probably just missing something obvious, but I am getting stale data
when searching right after the index update:

Settings settings = 
>> ImmutableSettings.settingsBuilder().put("client.transport.sniff", 
>> true).build();
>> TransportClient client = new 
>> TransportClient(settings).addTransportAddress(new 
>> InetSocketTransportAddress(host, port));
>> IndexResponse indexResponse = client.index(source).actionGet();
>> client.setQuery(matchAllQuery()).execute().get();

I thought index operation was synchronous? If I add a tiny delay between
the index and search operations, the updated data is being returned. I only
have a single node, no replication, with default settings. Can anyone point
me to the right direction here please?

regards,
Andrius Juozapaitis