# Does Elastic accept combined JSON with flatten keys

**URL:** <https://discuss.elastic.co/t/does-elastic-accept-combined-json-with-flatten-keys/344373>\
**Category:** Elasticsearch\
**Created:** [October 4, 2023, 10:02am UTC](https://discuss.elastic.co/t/does-elastic-accept-combined-json-with-flatten-keys/344373 "2023-10-04T10:02:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddoroshenko](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@ddoroshenko](https://discuss.elastic.co/u/ddoroshenko)\
**Post date:** [October 4, 2023, 10:02am UTC](https://discuss.elastic.co/t/does-elastic-accept-combined-json-with-flatten-keys/344373/1 "2023-10-04T10:02:13Z")

</div>

Hi,

is it possible to send to ES messages in combined JSON format

```auto
{
  "a": {
    "b": {
      "c.d.e.f": "value"
    }
  }
}

```

or it ends with error like `can't merge a non object mapping with an object mapping`?

---

<div class="post-metadata">

**Author:** ![Ofir\_Edi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ofir_edi/32/78181_2.png) [@Ofir\_Edi](https://discuss.elastic.co/u/Ofir_Edi)\
**Post date:** [October 4, 2023, 12:06pm UTC](https://discuss.elastic.co/t/does-elastic-accept-combined-json-with-flatten-keys/344373/2 "2023-10-04T12:06:17Z")

</div>

Hi @ddoroshenko ,  
It is possible to index the above document with the following:

```auto
POST index1/_doc
{
  "a": {
    "b": {
      "c.d.e.f": "value"
    }
  }
}

```

But, bear in mind that Elasticsearch treats fields with dots in their names as objects meaning that the above is equivelant to this:

```auto
{
  "a": {
    "b": {
      "c": {
	    "d": {
		  "e": {
		    "f": "value"
		  }
		}
	  }
    }
  }
}

```

You can also view this using GET \_mapping API on the `index1`:

```auto
{
  "index1": {
    "mappings": {
      "properties": {
        "a": {
          "properties": {
            "b": {
              "properties": {
                "c": {
                  "properties": {
                    "d": {
                      "properties": {
                        "e": {
                          "properties": {
                            "f": {
                              "type": "text",
                              "fields": {
                                "keyword": {
                                  "type": "keyword",
                                  "ignore_above": 256
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

```

Ofir

---

<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:** [November 2, 2023, 11:25am UTC](https://discuss.elastic.co/t/does-elastic-accept-combined-json-with-flatten-keys/344373/4 "2023-11-02T11:25:39Z")

</div>

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