1

I'm writing an indexer in Java for Elasticsearch, and I'm very afraid of pushing documents to index that doesn't have proper mapping, thus rendering it useless for my future queries.

Is there any method in official java client I can use so I can verify my create an index / put mapping requests not only landed in Elasticsearch cluster, but also were successfully applied, and cluster now is in a consistent state?

The thing I'm actually searching for is to make those requests synchronous rather than asynchronous, but I can't find anything like this in documentation (and I wonder if this is possible within Elasticsearch architecture).

2
  • The thing i'm actually searching for is to make those requests synchronous rather than asynchronous .Can you elaborate this line with respect to rest of the question? Commented Mar 19, 2016 at 19:38
  • @MayurBuragohain i was always bad at definitions. At current point, two operations - mapping application and scan-and-scroll inside my managing application - are not guaranteed to execute linearly, because mapping application, as far as i understand, is asynchronous operation and has a chance to complete after i push first document to ES. So i need to have some kind of guarantee that when i start scan-and-scroll, index is ready to accept documents, i guess it would be simply called 'to linearize those two operations'. Commented Mar 20, 2016 at 1:00

1 Answer 1

1

You can call the refresh API, which is synchronous, after setting your mapping.

Maybe somebody else with more experience can chime in with whether it's actually necessary or not.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.