0

I want to know what is the difference between if i create 20 records with bulk API and if i create 20 records with create API with elasticsearch.

Few questions:

  1. Does the index will updated only once in case of bulk API?
  2. Does the performance will be more in case of Bulk API?

1 Answer 1

4

With the bulk API, you'll make a single HTTP call to Elasticsearch in order to index 20 documents. With the normal create call, you'll need to make 20 HTTP calls in order to index the same 20 documents.

So from the networking performance point of view, you can deduct that making a single HTTP call will probably be more speedy than making 20 calls, i.e. you will experience the network latency only a single time.

Moreover, Elasticsearch has different thread pools to handle each call. The create calls will be handled by 20 threads from the index thread pool and the single bulk call will be handled by 1 single thread from the bulk thread pool.

So from a resource point of view, you can see that the single bulk call will be more friendly to Elasticsearch than 20 create calls.

Regarding your second question, the refresh rate of the index is once per second, so if your twenty calls take more than a second to execute, your index will probably be refreshed more than once. Whereas the bulk update call might execute in less than a second and so will be refreshed only once.

This is theoretical, of course, but common sense alone indicates that a single bulk call should be more performant than 20 create calls. And as always, the best way to find out is to try it out and time both approaches.

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

1 Comment

Do you still have any questions about this? Anything unclear?

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.