1

We are currently in the process of updating our project(Spring MVC application) which was based on Lucene 2.8, to ElasticSearch so basically the bottleneck of storing indexes will pass to ElasticSearch.

The application now will only call ElasticSearch Server for CRUD operations on indexes, will not carry dependencies and responsibilities for managing Lucene Documents, IndexWriter... basically just Json and will also show the results from search queries.

My question is: Will we need(or gain advantage) by using the Java API ElasticSearch offers instead of the Rest API because as far as I understand(ElasticSearch noob here) Java API will only add more code(and maven dependencies) in the application instead of just performing the REST calls since everything will be json now.

2 Answers 2

2

Elasticsearch Java API wraps json query building, but it's better for you to use java api, rather then manually json building, because in case of future updates it's much easier to update dependency, that to find json and find bugs, related to it.

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

Comments

0

Note that elasticsearch is great for read action, however, when you want to use synchronous process such as REST server to write to elasticseach, I found that the write actions tend to fail under pressure. For write action you should have an asynchronous process to handle such failures. That of course make your API not atomic, meaning, if you just added a resource, it won't necessarily will be returned when you ask for the list of resources, once because the write action may fail on the first time and succeed only later asynchronously, and second because elasticsearch is not realtime, it's "near realtime". To sum up, elasticsearch can't replace your DB, it's good only for large or complex searches on your exiting data.

For more REST API server guideline, see my blog: http://restafar.com/create-new-rest-server/

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.