# Difference on dotted notation vs dictionary

**URL:** <https://discuss.elastic.co/t/difference-on-dotted-notation-vs-dictionary/263450>\
**Category:** Elasticsearch\
**Created:** [February 5, 2021, 6:31pm UTC](https://discuss.elastic.co/t/difference-on-dotted-notation-vs-dictionary/263450 "2021-02-05T18:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![oskrdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oskrdt/32/67457_2.png) [@oskrdt](https://discuss.elastic.co/u/oskrdt)\
**Post date:** [February 5, 2021, 6:31pm UTC](https://discuss.elastic.co/t/difference-on-dotted-notation-vs-dictionary/263450/1 "2021-02-05T18:31:05Z")

</div>

I'm using a python script to populate data to elasticsearch using pandas to transform the data before the population.  
I was creating columns on pandas using dotted notation expecting that the elasticsearch index process wold transform the dotted notation into JSON dictionary, but it seems the fields are contained as individual fields on the `_source` called by the same dotted notation.

Example: I have the following on python

```auto
{
    "user.name": "Username",
    "user.email": "email@domain.com"
}

```

and I was expecting the index process to transform it to

```auto
{
    "user": {
        "name": "Username",
        "email": "email@domain.com"
}

```

Is there any real difference having individual dotted fields or nested dictionaries on `_source`?

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [February 5, 2021, 6:34pm UTC](https://discuss.elastic.co/t/difference-on-dotted-notation-vs-dictionary/263450/2 "2021-02-05T18:34:18Z")

</div>

You are allowed to use both formats. For fields that get indexed as `docvalues`, like `keyword` or numeric types, they will get indexed into docvalues under the dotted path regardless of how `_source` looks.

The only difference it makes is if you are reading from \_source- because \_source is the raw data that you sent to Elasticsearch, it's not transformed.

Edit: If you are interested in changing the format automatically, you can set up an ingestion pipeline which uses the [dot expand processor](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/dot-expand-processor.html)

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [February 6, 2021, 3:00am UTC](https://discuss.elastic.co/t/difference-on-dotted-notation-vs-dictionary/263450/3 "2021-02-06T03:00:38Z")

</div>

Hi @oskrdt

Just a comment.

As @wylie noted elasticsearch supports both formats, however as someone in the field that sees lots of data and lots of tools etc.. I would encourage you to look at the dot expander especially if you want to do any further processing in elasticsearch. Also I have found the sub-object ([technically not nested, it is an object](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html#object-types) ) to be more portable / cause less confusion.

---

<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:** [March 6, 2021, 3:01am UTC](https://discuss.elastic.co/t/difference-on-dotted-notation-vs-dictionary/263450/4 "2021-03-06T03:01:24Z")

</div>

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