# SparkSQL - Routing option vs "docs.deleted"

**URL:** <https://discuss.elastic.co/t/sparksql-routing-option-vs-docs-deleted/79779>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [March 23, 2017, 4:43pm UTC](https://discuss.elastic.co/t/sparksql-routing-option-vs-docs-deleted/79779 "2017-03-23T16:43:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eduardo\_Curonisy](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@Eduardo\_Curonisy](https://discuss.elastic.co/u/Eduardo_Curonisy)\
**Post date:** [March 23, 2017, 4:43pm UTC](https://discuss.elastic.co/t/sparksql-routing-option-vs-docs-deleted/79779/1 "2017-03-23T16:43:13Z")

</div>

Hi,

When i want to distribute data along shards i specify the "routing" option in my Spark code (with Scala) like this example:

EsSparkSQL.saveToEs(df, conf.getString("s-app.persistenciaES"), Map("[es.mapping.id](http://es.mapping.id)" -\> routing\_field))

The spark process finish without any errors, but when i see my index stats, my index have documents on two columns: "docs.count" and "docs.deleted"  
I dont have documentos on "docs.deleted" if i dont use routing option.

Do you know why some documents are distributed aleatory to "docs.deleted"?

thanks.

---

<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:** [April 20, 2017, 4:43pm UTC](https://discuss.elastic.co/t/sparksql-routing-option-vs-docs-deleted/79779/2 "2017-04-20T16:43:15Z")

</div>

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