# Query complex field

**URL:** <https://discuss.elastic.co/t/query-complex-field/6797>\
**Category:** Elasticsearch\
**Created:** [February 23, 2012, 7:58pm UTC](https://discuss.elastic.co/t/query-complex-field/6797 "2012-02-23T19:58:09Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 23, 2012, 7:58pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/1 "2012-02-23T19:58:09Z")

</div>

Here's my records: [https://gist.github.com/1894742](https://gist.github.com/1894742)

I need to be able to find this record where there is a relationship with an  
entityId = 5678 and a type = billTo

It seems that the fields path is being flattened into 3 arrays each  
containing the complete list of values. This is also in my gist

Does anyone have any idea why it's being flattened and how I can make this  
query?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 26, 2012, 7:20pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/2 "2012-02-26T19:20:19Z")

</div>

You need to use either nested mapping or parent/child for this.

On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:

> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this query?

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 27, 2012, 1:42am UTC](https://discuss.elastic.co/t/query-complex-field/6797/3 "2012-02-27T01:42:23Z")

</div>

Is there a way to have nested mappings auto detected within a template? I'm  
trying to keep my indexes schemaless if possible

On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:

> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 27, 2012, 1:06pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/4 "2012-02-27T13:06:31Z")

</div>

What do you mean by auto detected? You can have an index template set to apply to indices created.

On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:

> Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> > You need to use either nested mapping or parent/child for this.
> > 
> > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > 
> > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > 
> > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > 
> > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > 
> > > Does anyone have any idea why it's being flattened and how I can make this query?

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 29, 2012, 4:18am UTC](https://discuss.elastic.co/t/query-complex-field/6797/5 "2012-02-29T04:18:43Z")

</div>

the schema-less aspect of ES, can a dynamic mapping be setup that detects  
data that is nested and automatically match it to that mapping?

On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:

> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 29, 2012, 2:12pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/6 "2012-02-29T14:12:44Z")

</div>

No, you need to explicitly specify nested mappings.

On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:

> the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > 
> > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > 
> > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > 
> > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > 
> > > > You need to use either nested mapping or parent/child for this.
> > > > 
> > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > 
> > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > 
> > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > 
> > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > 
> > > > > Does anyone have any idea why it's being flattened and how I can make this query?

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [February 29, 2012, 6:25pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/7 "2012-02-29T18:25:45Z")

</div>

Here's what I plan on doing

I plan on creating a dynamic mapping rule that triggers when a new field of  
type "object" is detected. This rule will change the type to "nested" with  
all other appropriate attributes. By leaving the "include\_in\_parent" and "  
include\_in\_root" options set to true I'll be able query the objects the  
same as a normal object but also as a nested object

Since it's in a template it allows for a schema-less design of my index and  
more flexibility on how you query the data

What do you think? Any concerns I should keep in mind?

On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:

> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:

> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:

> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:

> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 1, 2012, 12:31pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/8 "2012-03-01T12:31:49Z")

</div>

Why do you want to have all object mapping be nested?

On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:

> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field of type "object" is detected. This rule will change the type to "nested" with all other appropriate attributes. By leaving the "include\_in\_parent" and "include\_in\_root" options set to true I'll be able query the objects the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> > No, you need to explicitly specify nested mappings.
> > 
> > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > 
> > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > 
> > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > 
> > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > 
> > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > 
> > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > 
> > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > 
> > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > 
> > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > 
> > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > 
> > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > 
> > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> > No, you need to explicitly specify nested mappings.
> > 
> > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > 
> > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > 
> > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > 
> > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > 
> > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > 
> > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > 
> > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > 
> > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > 
> > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > 
> > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > 
> > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > 
> > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> > No, you need to explicitly specify nested mappings.
> > 
> > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > 
> > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > 
> > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > 
> > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > 
> > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > 
> > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > 
> > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > 
> > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > 
> > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > 
> > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > 
> > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > 
> > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> > No, you need to explicitly specify nested mappings.
> > 
> > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > 
> > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > 
> > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > 
> > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > 
> > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > 
> > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > 
> > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > 
> > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > 
> > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > 
> > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > 
> > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > 
> > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [March 1, 2012, 3:13pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/9 "2012-03-01T15:13:55Z")

</div>

so that when an object contains a list of objects the applications will be  
able to match based on a search of the list of objects. Exactly like the  
example in my gist.

My ultimate goal here to create one master template that allows for the  
most flexibility when creating an index. I'd prefer not to have to create  
customized mappings for each record that I might index. I may have to at  
some point but for now I want to see how things go with 1 generic template.

The project is to create an operational data store that stores the master  
enterprise data in it's original form (matching indices in ES) and then  
produce context specific views (indices) of the data. These context  
specific views are defined through a ui (yet to be created) that will be  
able to add, update, or delete these specs. I would prefer to not have to  
do the work of analyzing the differences in the specs and creating custom  
mappings for each index I create. I will of course do that if I can't get  
the generic template setup to satisfy all the requirements. So, if forcing  
all objects to be nested allows the most flexibility for objects in general  
then I'd prefer to use it; however my last question to you was, do you know  
of any drawbacks to setting this up in this way that I should be aware of?

Thanks

On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:

> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:

> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:

> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:

> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 3, 2012, 9:37pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/10 "2012-03-03T21:37:34Z")

</div>

I see. What I meant by the question is that for a json object that is not really part of an array, there is no reason to use nested mapping, and its overhead (another indexed doc for the nested data) is not worth it. In any case, you can't automatically set all object types to nested, you have to do it explicitly.

On Thursday, March 1, 2012 at 5:13 PM, Wes Plunk wrote:

> so that when an object contains a list of objects the applications will be able to match based on a search of the list of objects. Exactly like the example in my gist.
> 
> My ultimate goal here to create one master template that allows for the most flexibility when creating an index. I'd prefer not to have to create customized mappings for each record that I might index. I may have to at some point but for now I want to see how things go with 1 generic template.
> 
> The project is to create an operational data store that stores the master enterprise data in it's original form (matching indices in ES) and then produce context specific views (indices) of the data. These context specific views are defined through a ui (yet to be created) that will be able to add, update, or delete these specs. I would prefer to not have to do the work of analyzing the differences in the specs and creating custom mappings for each index I create. I will of course do that if I can't get the generic template setup to satisfy all the requirements. So, if forcing all objects to be nested allows the most flexibility for objects in general then I'd prefer to use it; however my last question to you was, do you know of any drawbacks to setting this up in this way that I should be aware of?
> 
> Thanks
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> > Why do you want to have all object mapping be nested?
> > 
> > On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> > 
> > > Here's what I plan on doing
> > > 
> > > I plan on creating a dynamic mapping rule that triggers when a new field of type "object" is detected. This rule will change the type to "nested" with all other appropriate attributes. By leaving the "include\_in\_parent" and "include\_in\_root" options set to true I'll be able query the objects the same as a normal object but also as a nested object
> > > 
> > > Since it's in a template it allows for a schema-less design of my index and more flexibility on how you query the data
> > > 
> > > What do you think? Any concerns I should keep in mind?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> > Why do you want to have all object mapping be nested?
> > 
> > On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> > 
> > > Here's what I plan on doing
> > > 
> > > I plan on creating a dynamic mapping rule that triggers when a new field of type "object" is detected. This rule will change the type to "nested" with all other appropriate attributes. By leaving the "include\_in\_parent" and "include\_in\_root" options set to true I'll be able query the objects the same as a normal object but also as a nested object
> > > 
> > > Since it's in a template it allows for a schema-less design of my index and more flexibility on how you query the data
> > > 
> > > What do you think? Any concerns I should keep in mind?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> > Why do you want to have all object mapping be nested?
> > 
> > On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> > 
> > > Here's what I plan on doing
> > > 
> > > I plan on creating a dynamic mapping rule that triggers when a new field of type "object" is detected. This rule will change the type to "nested" with all other appropriate attributes. By leaving the "include\_in\_parent" and "include\_in\_root" options set to true I'll be able query the objects the same as a normal object but also as a nested object
> > > 
> > > Since it's in a template it allows for a schema-less design of my index and more flexibility on how you query the data
> > > 
> > > What do you think? Any concerns I should keep in mind?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> > Why do you want to have all object mapping be nested?
> > 
> > On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> > 
> > > Here's what I plan on doing
> > > 
> > > I plan on creating a dynamic mapping rule that triggers when a new field of type "object" is detected. This rule will change the type to "nested" with all other appropriate attributes. By leaving the "include\_in\_parent" and "include\_in\_root" options set to true I'll be able query the objects the same as a normal object but also as a nested object
> > > 
> > > Since it's in a template it allows for a schema-less design of my index and more flexibility on how you query the data
> > > 
> > > What do you think? Any concerns I should keep in mind?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?
> > > 
> > > On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> > > 
> > > > No, you need to explicitly specify nested mappings.
> > > > 
> > > > On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> > > > 
> > > > > the schema-less aspect of ES, can a dynamic mapping be setup that detects data that is nested and automatically match it to that mapping?
> > > > > 
> > > > > On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> > > > > 
> > > > > > What do you mean by auto detected? You can have an index template set to apply to indices created.
> > > > > > 
> > > > > > On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> > > > > > 
> > > > > > > Is there a way to have nested mappings auto detected within a template? I'm trying to keep my indexes schemaless if possible
> > > > > > > 
> > > > > > > On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> > > > > > > 
> > > > > > > > You need to use either nested mapping or parent/child for this.
> > > > > > > > 
> > > > > > > > On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> > > > > > > > 
> > > > > > > > > Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> > > > > > > > > 
> > > > > > > > > I need to be able to find this record where there is a relationship with an entityId = 5678 and a type = billTo
> > > > > > > > > 
> > > > > > > > > It seems that the fields path is being flattened into 3 arrays each containing the complete list of values. This is also in my gist
> > > > > > > > > 
> > > > > > > > > Does anyone have any idea why it's being flattened and how I can make this query?

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wes_plunk/32/2446_2.png) [@Wes\_Plunk](https://discuss.elastic.co/u/Wes_Plunk)\
**Post date:** [March 3, 2012, 9:45pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/11 "2012-03-03T21:45:24Z")

</div>

I did that and it seems to work just fine

On Saturday, March 3, 2012 3:37:34 PM UTC-6, kimchy wrote:

> I see. What I meant by the question is that for a json object that is not  
> really part of an array, there is no reason to use nested mapping, and its  
> overhead (another indexed doc for the nested data) is not worth it. In any  
> case, you can't automatically set all object types to nested, you have to  
> do it explicitly.
> 
> On Thursday, March 1, 2012 at 5:13 PM, Wes Plunk wrote:
> 
> so that when an object contains a list of objects the applications will be  
> able to match based on a search of the list of objects. Exactly like the  
> example in my gist.
> 
> My ultimate goal here to create one master template that allows for the  
> most flexibility when creating an index. I'd prefer not to have to create  
> customized mappings for each record that I might index. I may have to at  
> some point but for now I want to see how things go with 1 generic template.
> 
> The project is to create an operational data store that stores the master  
> enterprise data in it's original form (matching indices in ES) and then  
> produce context specific views (indices) of the data. These context  
> specific views are defined through a ui (yet to be created) that will be  
> able to add, update, or delete these specs. I would prefer to not have to  
> do the work of analyzing the differences in the specs and creating custom  
> mappings for each index I create. I will of course do that if I can't get  
> the generic template setup to satisfy all the requirements. So, if forcing  
> all objects to be nested allows the most flexibility for objects in general  
> then I'd prefer to use it; however my last question to you was, do you know  
> of any drawbacks to setting this up in this way that I should be aware of?
> 
> Thanks
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Thursday, March 1, 2012 6:31:49 AM UTC-6, kimchy wrote:
> 
> Why do you want to have all object mapping be nested?
> 
> On Wednesday, February 29, 2012 at 8:25 PM, Wes Plunk wrote:
> 
> Here's what I plan on doing
> 
> I plan on creating a dynamic mapping rule that triggers when a new field  
> of type "object" is detected. This rule will change the type to "nested"  
> with all other appropriate attributes. By leaving the "include\_in\_parent"  
> and "include\_in\_root" options set to true I'll be able query the objects  
> the same as a normal object but also as a nested object
> 
> Since it's in a template it allows for a schema-less design of my index  
> and more flexibility on how you query the data
> 
> What do you think? Any concerns I should keep in mind?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?
> 
> On Wednesday, February 29, 2012 8:12:44 AM UTC-6, kimchy wrote:
> 
> No, you need to explicitly specify nested mappings.
> 
> On Wednesday, February 29, 2012 at 6:18 AM, Wes Plunk wrote:
> 
> the schema-less aspect of ES, can a dynamic mapping be setup that detects  
> data that is nested and automatically match it to that mapping?
> 
> On Monday, February 27, 2012 7:06:31 AM UTC-6, kimchy wrote:
> 
> What do you mean by auto detected? You can have an index template set to  
> apply to indices created.
> 
> On Monday, February 27, 2012 at 3:42 AM, Wes Plunk wrote:
> 
> Is there a way to have nested mappings auto detected within a template?  
> I'm trying to keep my indexes schemaless if possible
> 
> On Sunday, February 26, 2012 1:20:19 PM UTC-6, kimchy wrote:
> 
> You need to use either nested mapping or parent/child for this.
> 
> On Thursday, February 23, 2012 at 9:58 PM, Wes Plunk wrote:
> 
> Here's my records: [record 1 · GitHub](https://gist.github.com/1894742)
> 
> I need to be able to find this record where there is a relationship with  
> an entityId = 5678 and a type = billTo
> 
> It seems that the fields path is being flattened into 3 arrays each  
> containing the complete list of values. This is also in my gist
> 
> Does anyone have any idea why it's being flattened and how I can make this  
> query?

---

<div class="post-metadata">

**Author:** ![Wes\_Plunk\_2](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@Wes\_Plunk\_2](https://discuss.elastic.co/u/Wes_Plunk_2)\
**Post date:** [September 18, 2012, 5:01pm UTC](https://discuss.elastic.co/t/query-complex-field/6797/12 "2012-09-18T17:01:04Z")

</div>

For anyone who finds this post, I wanted to let you know that after  
following my initial path of making my indices as flexible as possible I  
discovered that the performance degraded way too fast. We reverted to the  
most minimal of mappings and am in the process of automating the process so  
our customer can modify the behavior and have that behavior reflected in  
our mappings (new analyzing, synonyms, etc). Thanks for the help.

--

---

<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, 3:12am UTC](https://discuss.elastic.co/t/query-complex-field/6797/13 "2017-07-06T03:12:27Z")

</div>


