# Dynamic Document Mapping Design Help

**URL:** <https://discuss.elastic.co/t/dynamic-document-mapping-design-help/13622>\
**Category:** Elasticsearch\
**Created:** [September 16, 2013, 2:14pm UTC](https://discuss.elastic.co/t/dynamic-document-mapping-design-help/13622 "2013-09-16T14:14:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gustavo\_Chain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_chain/32/2109_2.png) [@Gustavo\_Chain](https://discuss.elastic.co/u/Gustavo_Chain)\
**Post date:** [September 16, 2013, 2:14pm UTC](https://discuss.elastic.co/t/dynamic-document-mapping-design-help/13622/1 "2013-09-16T14:14:51Z")

</div>

Hi everybody!

I'm trying to define the the best mapping for my documents. Documents  
represents surveys's response and looks like the following example:

And my actual mapping looks like:

> 

survey\_id: "someuid",

> answers: [  
> {question\_id: 'theID', term: 'yes'}  
> {question\_id: 'anyID', text: 'another response'}  
> and so on ...  
> ]

And my mapping looks like:

answer: {

> properties: {  
> survey\_id: {type: 'string'}  
> answers: {  
> type: "nested",  
> term: {type: "string", index: "not\_analyzed"},  
> text: {type: "string"},

```
  range: {type: "double"},

  question_id: {type: "string", index: "not_analyzed"}

```

> ```
> }
> 
> ```
> 
> }  
> }

Do you think that this is a correct mapping ?  
As each answer can have different value type (long texts -\> text type,  
words -\> term type, booleans, numbers, etc), is there any other mapping  
design I should use.

Thank you very much!

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:16am UTC](https://discuss.elastic.co/t/dynamic-document-mapping-design-help/13622/2 "2017-07-06T02:16:20Z")

</div>


