# How to assign weight attribute to a completion suggester field using Elasticsearch Hadoop connector (Spark/Databricks)

**URL:** https://discuss.elastic.co/t/how-to-assign-weight-attribute-to-a-completion-suggester-field-using-elasticsearch-hadoop-connector-spark-databricks/358815
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [May 6, 2024, 11:17am UTC](https://discuss.elastic.co/t/how-to-assign-weight-attribute-to-a-completion-suggester-field-using-elasticsearch-hadoop-connector-spark-databricks/358815 "2024-05-06T11:17:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![landlord\_matt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/landlord_matt/32/134159_2.png) [@landlord\_matt](https://discuss.elastic.co/u/landlord_matt)
#### Post date: [May 6, 2024, 11:17am UTC](https://discuss.elastic.co/t/how-to-assign-weight-attribute-to-a-completion-suggester-field-using-elasticsearch-hadoop-connector-spark-databricks/358815/1 "2024-05-06T11:17:28Z")

</div>

Hi!

We're successfully using the `org.elasticsearch.spark.sql` driver to upload our Databricks Spark tables as Elasticsearch indices. We now want to assign the weight attribute to one of our suggester fields in order to give a deterministic result (note that you can't sort on these types of fields). In the API, this is achieved by specifiying the weight attribute as part of each document as seen in [the official documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html#indexing).

How do I do this using the es-hadoop driver? I tried assigning a column in my DataFrame called weight, but then I get an error because it no longer matches our strict mapping. I couldn't find any information about this. There is for example [no obvious parameter](https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html).

```auto
    (
        data.write.format("org.elasticsearch.spark.sql")
        .options(**es_conf)
        .mode("overwrite")
        .save(full_index_name)
    )

```
