# Internals of array of strings vs. concatenated string

**URL:** <https://discuss.elastic.co/t/internals-of-array-of-strings-vs-concatenated-string/257640>\
**Category:** Elasticsearch\
**Created:** [December 4, 2020, 9:33am UTC](https://discuss.elastic.co/t/internals-of-array-of-strings-vs-concatenated-string/257640 "2020-12-04T09:33:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mitar/32/80257_2.png) [@mitar](https://discuss.elastic.co/u/mitar)\
**Post date:** [December 4, 2020, 9:33am UTC](https://discuss.elastic.co/t/internals-of-array-of-strings-vs-concatenated-string/257640/1 "2020-12-04T09:33:05Z")

</div>

I am trying to better understand internals of ElasticSearch, so I would like to know if there are any differences in how ElasticSearch internally computes term statistics for the following two cases.

The first case is when I have documents like:

```auto
{
  "foo": [
    {
      "bar": "long string"
    },
    {
      "bar": "another long string"
    }
  ]
}

```

Or a document like:

```auto
{
  "foobar": "long string another long string"
}

```

My understanding is that the first document gets flattened to:

```auto
{
  "foo.bar": ["long string", "another long string"]
}

```

So it seems the question is really, is the second and third documents indexed the same? Is term statistics computed the same?

---

<div class="post-metadata">

**Author:** ![mitar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mitar/32/80257_2.png) [@mitar](https://discuss.elastic.co/u/mitar)\
**Post date:** [December 17, 2020, 5:59pm UTC](https://discuss.elastic.co/t/internals-of-array-of-strings-vs-concatenated-string/257640/2 "2020-12-17T17:59:42Z")

</div>

I got an answer to it on [Stack Overflow](https://stackoverflow.com/questions/65271653/internals-of-array-of-strings-vs-concatenated-string-in-elasticsearch/65306686).

---

<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:** [January 14, 2021, 5:59pm UTC](https://discuss.elastic.co/t/internals-of-array-of-strings-vs-concatenated-string/257640/3 "2021-01-14T17:59:48Z")

</div>

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