# Re: Mapping Arrays - Weird Question

**URL:** <https://discuss.elastic.co/t/re-mapping-arrays-weird-question/16942>\
**Category:** Elasticsearch\
**Created:** [April 10, 2014, 11:34pm UTC](https://discuss.elastic.co/t/re-mapping-arrays-weird-question/16942 "2014-04-10T23:34:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [April 10, 2014, 11:34pm UTC](https://discuss.elastic.co/t/re-mapping-arrays-weird-question/16942/1 "2014-04-10T23:34:50Z")

</div>

Hi,

There is no need for a particular type for arrays[1]. Elasticsearch  
automatically detects arrays, so instead of declaring a field as an array,  
you need to declare what it contains. For example, assuming that  
variablesUsed is an array of strings, you could define it as

"variablesUsed" : {"type" : "string", "store" : true, "index" : "analyzed"}

[1]

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Thu, Apr 10, 2014 at 2:52 PM, roblangenfeld [roblangenfeld@gmail.com](mailto:roblangenfeld@gmail.com)wrote:

> So I'm working on the JSON mapping for several of our documents and one of  
> the fields happens to be a string array.
> 
> I looked at the documentation for how it's supposed to be done and it left  
> me confused. Could someone clarify it for me?
> 
> Here is essentially what I want to happen (part of my mapping):
> 
> "properties" :{  
> ...  
> "variableId" : {"type" : "string", "store" : true, "index" :  
> "not\_analyzed"},  
> "variableDisplayName" : {"type" : "string", "store" : true, "index" :  
> "analyzed"},  
> "variablesUsed" : {"type" : "array", "store" : true, "index" : "analyzed"},  
> "encryptedStatus" : {"type" : "boolean", "store" : true, "index" :  
> "not\_analyzed"},  
> ...  
> }
> 
> The third line being the string array. I know the syntax is wrong but that  
> is essentially what i want to accomplish. So with that being said would  
> this  
> be how I map it?:  
> "properties" :{  
> ...  
> "variableId" : {"type" : "string", "store" : true, "index" :  
> "not\_analyzed"},  
> "variableDisplayName" : {"type" : "string", "store" : true, "index" :  
> "analyzed"},  
> "variablesUsed" : {"type" : "array", "store" : true, "index" : "analyzed"},  
> "lists" : {  
> "properties" : {  
> "variablesUsed" : {"type" : "string", "store" : true,  
> "index" : "analyzed"}]  
> }  
> },  
> "encryptedStatus" : {"type" : "boolean", "store" : true, "index" :  
> "not\_analyzed"},  
> ...  
> }
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Mapping-Arrays-Weird-Question-tp4053902.html](http://elasticsearch-users.115913.n3.nabble.com/Mapping-Arrays-Weird-Question-tp4053902.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> 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/1397134368768-4053902.post%40n3.nabble.com](https://groups.google.com/d/msgid/elasticsearch/1397134368768-4053902.post%40n3.nabble.com)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j4\_D9m0cUtVaPG3dHsRXfa%2BnedSH%3DTiWuHCCoLk5iLopQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4_D9m0cUtVaPG3dHsRXfa%2BnedSH%3DTiWuHCCoLk5iLopQ%40mail.gmail.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:36am UTC](https://discuss.elastic.co/t/re-mapping-arrays-weird-question/16942/2 "2017-07-06T01:36:42Z")

</div>


