# Nested filter returns 0 results

**URL:** <https://discuss.elastic.co/t/nested-filter-returns-0-results/15561>\
**Category:** Elasticsearch\
**Created:** [February 3, 2014, 5:10pm UTC](https://discuss.elastic.co/t/nested-filter-returns-0-results/15561 "2014-02-03T17:10:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andra\_Bennett](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Andra\_Bennett](https://discuss.elastic.co/u/Andra_Bennett)\
**Post date:** [February 3, 2014, 5:10pm UTC](https://discuss.elastic.co/t/nested-filter-returns-0-results/15561/1 "2014-02-03T17:10:09Z")

</div>

Hello,

I have the following document:

[someemail@email.com](mailto:someemail@email.com)

I index the above document relying on dynamic mappings.

First I set an initial mapping as :

{  
"index1" :  
{  
"date\_detection":false,  
"properties":  
{  
"basic":  
{  
"type": nested  
}  
}  
}  
}

I try to search for this document using the following nested filter:

NestedFilterBuilder filterBasic = new NestedFilterBuilder("basic",  
QueryBuilders.fieldQuery("basic.content", "someemail@email.com"))

When I print out the mappings (after indexing) I get the following:

{"requests":{"date\_detection":false,"properties":{"basic":{"type":"nested","properties":{"contact":{"type":"string"}}}}}}

I get no results (with elastic search v. 0.90.0).

Is the filter incorrect for the mapping provided?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f3dff12b-a40b-4e87-add6-70ee13c4d8c1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f3dff12b-a40b-4e87-add6-70ee13c4d8c1%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![John\_Ohno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_ohno/32/1746_2.png) [@John\_Ohno](https://discuss.elastic.co/u/John_Ohno)\
**Post date:** [February 3, 2014, 6:50pm UTC](https://discuss.elastic.co/t/nested-filter-returns-0-results/15561/2 "2014-02-03T18:50:55Z")

</div>

Are you sure you don't want to be using:

NestedFilterBuilder filterBasic = new NestedFilterBuilder("basic",  
QueryBuilders.fieldQuery("basic.contact", "[some...@email.com](mailto:some...@email.com)"))

On Monday, February 3, 2014 12:10:09 PM UTC-5, Andra Bennett wrote:

> Hello,
> 
> I have the following document:
> 
> [some...@email.com](mailto:some...@email.com) \<javascript:\>
> 
> I index the above document relying on dynamic mappings.
> 
> First I set an initial mapping as :
> 
> {  
> "index1" :  
> {  
> "date\_detection":false,  
> "properties":  
> {  
> "basic":  
> {  
> "type": nested  
> }  
> }  
> }  
> }
> 
> I try to search for this document using the following nested filter:
> 
> NestedFilterBuilder filterBasic = new NestedFilterBuilder("basic",  
> QueryBuilders.fieldQuery("basic.content", "[some...@email.com](mailto:some...@email.com) \<javascript:\>  
> "))
> 
> When I print out the mappings (after indexing) I get the following:
> 
> {"requests":{"date\_detection":false,"properties":{"basic":{"type":"nested","properties":{"contact":{"type":"string"}}}}}}
> 
> I get no results (with Elasticsearch v. 0.90.0).
> 
> Is the filter incorrect for the mapping provided?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/10b05d8e-699d-4dd0-b31a-51e4ec8cf10e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/10b05d8e-699d-4dd0-b31a-51e4ec8cf10e%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Andra\_Bennett](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@Andra\_Bennett](https://discuss.elastic.co/u/Andra_Bennett)\
**Post date:** [February 3, 2014, 9:10pm UTC](https://discuss.elastic.co/t/nested-filter-returns-0-results/15561/3 "2014-02-03T21:10:16Z")

</div>

Same issue with the nested filter - returns no results.

I actually played around with removing the nested type from the mapping,  
and that's how I got to write the plain filter

On Monday, February 3, 2014 12:10:09 PM UTC-5, Andra Bennett wrote:

> Hello,
> 
> I have the following document:
> 
> [someemail@email.com](mailto:someemail@email.com)
> 
> I index the above document relying on dynamic mappings.
> 
> First I set an initial mapping as :
> 
> {  
> "index1" :  
> {  
> "date\_detection":false,  
> "properties":  
> {  
> "basic":  
> {  
> "type": nested  
> }  
> }  
> }  
> }
> 
> I try to search for this document using the following nested filter:
> 
> NestedFilterBuilder filterBasic = new NestedFilterBuilder("basic",  
> QueryBuilders.fieldQuery("basic.content", "[someemail@email.com](mailto:someemail@email.com)"))
> 
> When I print out the mappings (after indexing) I get the following:
> 
> {"requests":{"date\_detection":false,"properties":{"basic":{"type":"nested","properties":{"contact":{"type":"string"}}}}}}
> 
> I get no results (with Elasticsearch v. 0.90.0).
> 
> Is the filter incorrect for the mapping provided?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/4a642321-2925-4b90-a4d1-0348422171c9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4a642321-2925-4b90-a4d1-0348422171c9%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:53am UTC](https://discuss.elastic.co/t/nested-filter-returns-0-results/15561/4 "2017-07-06T01:53:03Z")

</div>


