There isn't a way to wait till it gets indexed in elasticsearch, I mean,
the river does not expose it. I can't think of a really nice solution
except maybe to do a get for hte doc in elasticsearch (without the _source,
i.e. empty fields), and then poll the doc with another get till the
_version changes...
On Tue, Mar 27, 2012 at 3:39 PM, Andrius Juozapaitis andriusj@gmail.comwrote:
Hey all,
Looking for advice here. I am using couchdb as my data store, with
elasticsearch handling pretty much all the read operations. I've
encountered an issue with the near-real-time indexing through couchdb
river though:
- My spring MVC controller extracts data (say, a product list) using
elasticsearch java api- The user submits a new product
- The product is saved in couchdb
- The controller, following a redirect-after-post pattern, does an
http redirect to the product list (see 1.)The problem here is that the controller in step 1. is querying
elasticsearch data which hasn't been updated yet by the couchdb river.
I am aware there are a number of potential solutions to this problem
(also storing the saved data in session, querying couchdb directly,
delaying the redirect, using ajax, etc).The most transparent way, IMHO, would be to issue a request to
elasticsearch (or couchdb river?) that would block until the couchdb
river processes all the pending changes in the _changes feed, and only
then perform the http redirect in the step 4. Is it possible to do
through the existing APIs? Are there any other options I missed? In
other words, I'd be happy for any constructive feedback here.Best regards,
Andrius