# Best approach to dynamically index JSON docs having types that can change

**URL:** <https://discuss.elastic.co/t/best-approach-to-dynamically-index-json-docs-having-types-that-can-change/18589>\
**Category:** Elasticsearch\
**Created:** [July 10, 2014, 8:26pm UTC](https://discuss.elastic.co/t/best-approach-to-dynamically-index-json-docs-having-types-that-can-change/18589 "2014-07-10T20:26:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Barclay](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@Ken\_Barclay](https://discuss.elastic.co/u/Ken_Barclay)\
**Post date:** [July 10, 2014, 8:26pm UTC](https://discuss.elastic.co/t/best-approach-to-dynamically-index-json-docs-having-types-that-can-change/18589/1 "2014-07-10T20:26:28Z")

</div>

Hello,

I just started with ES and used 1.2.1 and the Hadoop interface to push log  
data into Hadoop (HDP 2.1) via a Hive external table having defined fields.  
That worked great.

Our event logs are JSON and I next want to dynamically index the entire  
document instead of just designated fields. However some fields can come  
through as, say, String, in some records, while at other times that same  
field will be a complex nested type of some sort. This upset ES because it  
expects the field, once indexed, to stay the same type.

Any suggestions as the best way to deal with this? I'm looking at ways to  
flatten in the incoming structures but maybe ES has something built-in  
that's more elegant.

Thanks  
Ken

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1a708d5f-06fc-4ba6-8351-72f0be6a59c7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1a708d5f-06fc-4ba6-8351-72f0be6a59c7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:16am UTC](https://discuss.elastic.co/t/best-approach-to-dynamically-index-json-docs-having-types-that-can-change/18589/2 "2017-07-06T01:16:42Z")

</div>


