Slow updates with prepareIndex Java API

Hi,

I'm a bit new to ElasticSearch so a bit stuck on this problem:

We use a prepareIndex query to elasticSearch (v 0.18.4) using the Java API

           client.prepareIndex(index,valueType, key)

               .setSource(json)

               .execute()

               .actionGet()

However, the update in elasticSearch takes a while (magnitude of hours) to
show up. Are there any settings in elastic search that we need to be aware
of which can help us amend this and get immediate updates?

We have 1 replica, 5 shards. It used to immediately update until recently
and we've tried flushing the index and that doesn't help either.

Thanks

pbala wrote:

We use a prepareIndex query to elasticSearch (v 0.18.4) using the Java API

           client.prepareIndex(index,valueType, key)
               .setSource(json)
               .execute()
               .actionGet()

However, the update in elasticSearch takes a while (magnitude of
hours) to show up. Are there any settings in Elasticsearch that we
need to be aware of which can help us amend this and get immediate
updates?

You need to refresh the index. If you're just doing an individual
index operation and you want to see the results show up in search,
you should perform a client.admin().indices().prepareRefresh(index)
afterward.

If you need to change ES's default refresh interval, you can change
this value to something within a few min:

index.engine.robin.refresh_interval: 5m

Don't drop that too low though because it will slow indexing
considerably while ES has to wait for disk IO.

-Drew