# Defining IDs and routing keys for documents in custom workloads in Rally

**URL:** <https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186>\
**Category:** Elasticsearch\
**Tags:** rally\
**Created:** [June 4, 2019, 1:07pm UTC](https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186 "2019-06-04T13:07:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luisrpp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luisrpp/32/7625_2.png) [@luisrpp](https://discuss.elastic.co/u/luisrpp)\
**Post date:** [June 4, 2019, 1:07pm UTC](https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186/1 "2019-06-04T13:07:28Z")

</div>

Hi,

It seems that there was a way to create a custom track with an index operation to load documents in ES with custom IDs and routing keys, as described in the following post:

> [@How to index routing id based document in rally](https://discuss.elastic.co/t/how-to-index-routing-id-based-document-in-rally/95321):
>
> Hi I want to do a routing id based bulk index in rally ,i know how to do in rest call ,but using rally i dont know how to pass routing id,can you please guide me how to do it This way i used routing based index in rest call Mapping { "\_routing": { "required": true, "path": "customerID" } } rest call test/type1/\_bulk?routing=2 { "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } } {"firstname":"first\_name1","lastname":"last\_name1","client":100,"customerID":2} { "index" …

As this is not valid for rally's current version, how can we perform this operation now?

Best regards,  
Luis

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [June 5, 2019, 7:13am UTC](https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186/2 "2019-06-05T07:13:38Z")

</div>

> [@luisrpp](#):
>
> As this is not valid for rally's current version

Hi,

can you please share what you've attempted exactly and the error message that you got?

Daniel

---

<div class="post-metadata">

**Author:** ![luisrpp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luisrpp/32/7625_2.png) [@luisrpp](https://discuss.elastic.co/u/luisrpp)\
**Post date:** [June 5, 2019, 1:45pm UTC](https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186/3 "2019-06-05T13:45:49Z")

</div>

I was trying to load a file like this:

```
{ “index” : { “_index” : “test”, “_type” : “type1”, “_id” : “1”, “_routing : 2 } }
{“firstname”:“first_name1”,“lastname”:“last_name1”,“client”:100,“customerID”:2}
{ “index” : { “_index” : “test”, “_type” : “type1”, “_id” : “2”, “_routing : 2 } }
{“firstname”:“first_name2”,“lastname”:“last_name2”,“client”:100,“customerID”:2}
{ “index” : { “_index” : “test”, “_type” : “type1”, “_id” : “3”, “_routing : 2 } }
{“firstname”:“first_name3”,“lastname”:“last_name3”,“client”:200,“customerID”:2}

```

Based on this post ([How to index routing id based document in rally](https://discuss.elastic.co/t/how-to-index-routing-id-based-document-in-rally/95321/2)), I was trying to use the same approach, with `"operation-type": "index"`. Got a message that this is an invalid operation.

Just realized that there is a property for documents called `includes-action-and-meta-data`. That solved the problem.

Sorry I didn't check that before.

Regards,  
Luis

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [June 5, 2019, 1:57pm UTC](https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186/4 "2019-06-05T13:57:41Z")

</div>

Hi,

no worries and glad that it's resolved now. 🙂 Thanks for following up.

Daniel

---

<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:** [July 3, 2019, 1:57pm UTC](https://discuss.elastic.co/t/defining-ids-and-routing-keys-for-documents-in-custom-workloads-in-rally/184186/5 "2019-07-03T13:57:44Z")

</div>

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