# Indexing single document

**URL:** <https://discuss.elastic.co/t/indexing-single-document/240636>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [July 10, 2020, 3:04am UTC](https://discuss.elastic.co/t/indexing-single-document/240636 "2020-07-10T03:04:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit.surana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit.surana/32/71919_2.png) [@amit.surana](https://discuss.elastic.co/u/amit.surana)\
**Post date:** [July 10, 2020, 3:04am UTC](https://discuss.elastic.co/t/indexing-single-document/240636/1 "2020-07-10T03:04:17Z")

</div>

Hi Team,  
We are planning to use ElasticSearch and to test our expected load we want to run some load test. I was looking at custom track options and see that `bulk` operation is used for indexing documents. However, we won't be able to use bulk api's in production, and would be using `put` api's to create/update document. Can i simulate this using Rally? Is this equivalent to using bulk with `bulk-size=1`? If not, are there any out of the box operation to achieve indexing of single document?

---

<div class="post-metadata">

**Author:** ![baz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baz/32/5183_2.png) [@baz](https://discuss.elastic.co/u/baz)\
**Post date:** [July 15, 2020, 10:08pm UTC](https://discuss.elastic.co/t/indexing-single-document/240636/2 "2020-07-15T22:08:04Z")

</div>

Technically a bulk operation with a bulk size of 1 is not the same as indexing a single document. The bulk payload needs additional information in a ndjson format, and that in itself will be different than if you sent only one document. Rally does not have an [operation](https://esrally.readthedocs.io/en/stable/track.html#operations) that supports indexing a single document out of the box.

Authoring a [custom runner](https://esrally.readthedocs.io/en/stable/adding_tracks.html#adding-tracks-custom-runners) can get your what you want. This is a performance critical codepath, and it is easy to generate results that are not accurate if something is messed up in a custom runner.

That said, bulk requests are much more efficient than a single `PUT` to create a document. There is a lot of network layer overhead to sending single requests that can be alleviated with a bulk operation. It is likely you will see bottlenecks in `PUT` requests in your application, before you get close to exhausting Elasticsearch's ability to index `bulk` requests.

---

<div class="post-metadata">

**Author:** ![amit.surana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit.surana/32/71919_2.png) [@amit.surana](https://discuss.elastic.co/u/amit.surana)\
**Post date:** [July 18, 2020, 9:03am UTC](https://discuss.elastic.co/t/indexing-single-document/240636/3 "2020-07-18T09:03:27Z")

</div>

Got it. Thanks you! We will eventually move to bulk however, for our initial launch we are thinking of indexing single document. I will look into other options for load testing. We are getting live events which will be inserted/indexed into ElasticSearch, and customer would query elasticsearch for this information. We cannot wait for batching the events hence we might index single document.

---

<div class="post-metadata">

**Author:** ![dliappis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dliappis/32/56174_2.png) [@dliappis](https://discuss.elastic.co/u/dliappis)\
**Post date:** [July 27, 2020, 6:08am UTC](https://discuss.elastic.co/t/indexing-single-document/240636/4 "2020-07-27T06:08:33Z")

</div>

Just a small FYI, for one off API operations, apart from using a [custom runner](https://esrally.readthedocs.io/en/stable/adding_tracks.html#adding-tracks-custom-runners), the [raw request](https://esrally.readthedocs.io/en/stable/track.html?highlight=raw%20request#raw-request) operation can also be useful.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 24, 2020, 6:08am UTC](https://discuss.elastic.co/t/indexing-single-document/240636/5 "2020-08-24T06:08:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
