# Is a field nested?

**URL:** <https://discuss.elastic.co/t/is-a-field-nested/10294>\
**Category:** Elasticsearch\
**Created:** [January 10, 2013, 12:16pm UTC](https://discuss.elastic.co/t/is-a-field-nested/10294 "2013-01-10T12:16:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DH1](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@DH1](https://discuss.elastic.co/u/DH1)\
**Post date:** [January 10, 2013, 12:16pm UTC](https://discuss.elastic.co/t/is-a-field-nested/10294/1 "2013-01-10T12:16:13Z")

</div>

Hi, everyone.

I do not know if it is even possible, but I am looking for a way to know if  
a field is nested or not, using its path.

For instance, i want to know if "this.is.a.path" is of nested type or  
not.  
Of course, I know the index and the type, too.

I am currently working with the Java api.

Thanks in advance for any infos.

--

---

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [January 10, 2013, 12:58pm UTC](https://discuss.elastic.co/t/is-a-field-nested/10294/2 "2013-01-10T12:58:34Z")

</div>

You could get the mapping for the index by doing something like this:

```
        ClusterStateResponse clusterStateResponse = 

```

clusterStateRequest.execute().actionGet();  
ClusterState clusterState = clusterStateResponse.getState();  
IndexMetaData indexMetaData =  
clusterState.getMetaData().index(sourceIndex);  
ImmutableMap\<String, MappingMetaData\> mappings =  
indexMetaData.getMappings();

And in the mappings map you should find the information you are looking for.

Greets  
Andrej

Am Donnerstag, 10. Januar 2013 13:16:13 UTC+1 schrieb DH:

> Hi, everyone.
> 
> I do not know if it is even possible, but I am looking for a way to know  
> if a field is nested or not, using its path.
> 
> For instance, i want to know if "this.is.a.path" is of nested type or  
> not.  
> Of course, I know the index and the type, too.
> 
> I am currently working with the Java api.
> 
> Thanks in advance for any infos.

--

---

<div class="post-metadata">

**Author:** ![DH1](https://avatars.discourse-cdn.com/v4/letter/d/65b543/32.png) [@DH1](https://discuss.elastic.co/u/DH1)\
**Post date:** [January 10, 2013, 4:18pm UTC](https://discuss.elastic.co/t/is-a-field-nested/10294/3 "2013-01-10T16:18:20Z")

</div>

Thanks, Andrej.  
I hadn't thought about that.  
That should do it.

Le jeudi 10 janvier 2013 13:16:13 UTC+1, DH a écrit :

> Hi, everyone.
> 
> I do not know if it is even possible, but I am looking for a way to know  
> if a field is nested or not, using its path.
> 
> For instance, i want to know if "this.is.a.path" is of nested type or  
> not.  
> Of course, I know the index and the type, too.
> 
> I am currently working with the Java api.
> 
> Thanks in advance for any infos.

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:57am UTC](https://discuss.elastic.co/t/is-a-field-nested/10294/4 "2017-07-06T02:57:00Z")

</div>


