# Query returns results in ES Head but not Java API after using Update API?

**URL:** <https://discuss.elastic.co/t/query-returns-results-in-es-head-but-not-java-api-after-using-update-api/12261>\
**Category:** Elasticsearch\
**Created:** [June 4, 2013, 5:46pm UTC](https://discuss.elastic.co/t/query-returns-results-in-es-head-but-not-java-api-after-using-update-api/12261 "2013-06-04T17:46:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grantgochnauer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grantgochnauer/32/2300_2.png) [@grantgochnauer](https://discuss.elastic.co/u/grantgochnauer)\
**Post date:** [June 4, 2013, 5:46pm UTC](https://discuss.elastic.co/t/query-returns-results-in-es-head-but-not-java-api-after-using-update-api/12261/1 "2013-06-04T17:46:10Z")

</div>

Hello ES folks --

I'm running into an interesting inconsistency (or so it appears) between the same query executed via ElasticSearch Head and the client java API where the query in ES Head returns results as expected but using the Java API, no results are returned. At first I thought it was simply something I'm doing in the JAVA API (i.e. restricting class names or something that you do in the Java API you don't do in ES Head) but after triple checking these, I cannot find the difference.

I suspect it may have to do with how I'm using the java update API on the new value I'm filtering on but can't be sure.

When the index is created, this model is added:

> <https://gist.github.com/GrantGochnauer/5707877>

When I run the following query in ES Head, it works:

> <https://gist.github.com/GrantGochnauer/5707892>

The same query via the ES Java API (as seen as logging to our console) returns 0 results. This was the query I copied and pasted in ES Head.

The only thing I can think of is that the value that isn't filtering properly in the java api is "altNames" which when I remove the term filter, values come back. I added the value to altNames in the index by calling the update route in the java api.

Is it possible this is an issue with "versions" of the same document? In ES Head, the \_version value is 3. This object also is the parent of a parent/child relationship - I'm not sure if that makes a difference.

I am using ES 0.20.6.

I'm a bit stuck - and this only seems to be for terms which I've used the Java update API. I also can't think of any reasons why a query in ES Head would return different results than the same query executed via Java API.

Thanks  
Grant

--  
Grant Gochnauer | Vodori Inc | [grant.gochnauer@vodori.com](mailto:grant.gochnauer@vodori.com) | (w) 312.324.0124 | (c) 312.504.5004

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![grantgochnauer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grantgochnauer/32/2300_2.png) [@grantgochnauer](https://discuss.elastic.co/u/grantgochnauer)\
**Post date:** [June 4, 2013, 6:32pm UTC](https://discuss.elastic.co/t/query-returns-results-in-es-head-but-not-java-api-after-using-update-api/12261/2 "2013-06-04T18:32:05Z")

</div>

So I started tweaking my query in JAVA, and now I have a query that works  
in JAVA too but it's strange why it's working. I simply removed the nested  
filter on path. Here is the working query (although now incomplete):

> <https://gist.github.com/GrantGochnauer/5708260>

It's strange that the original query works in ES Head but not in JAVA API  
and then when I remove the nested filter, it works in JAVA.

Grant

On Tuesday, June 4, 2013 12:46:10 PM UTC-5, Grant Gochnauer wrote:

> Hello ES folks --
> 
> I'm running into an interesting inconsistency (or so it appears) between  
> the same query executed via Elasticsearch Head and the client java API  
> where the query in ES Head returns results as expected but using the Java  
> API, no results are returned. At first I thought it was simply something  
> I'm doing in the JAVA API (i.e. restricting class names or something that  
> you do in the Java API you don't do in ES Head) but after triple checking  
> these, I cannot find the difference.
> 
> I suspect it may have to do with how I'm using the java update API on the  
> new value I'm filtering on but can't be sure.
> 
> When the index is created, this model is added:
> 
> [Sample ES Model for List question · GitHub](https://gist.github.com/GrantGochnauer/5707877)
> 
> When I run the following query in ES Head, it works:
> 
> [Query which is failing · GitHub](https://gist.github.com/GrantGochnauer/5707892)
> 
> The same query via the ES Java API (as seen as logging to our console)  
> returns 0 results. This was the query I copied and pasted in ES Head.
> 
> The only thing I can think of is that the value that isn't filtering  
> properly in the java api is "altNames" which when I remove the term filter,  
> values come back. I added the value to altNames in the index  
> by calling the update route in the java api.
> 
> Is it possible this is an issue with "versions" of the same document? In  
> ES Head, the \_version value is 3. This object also is the parent of a  
> parent/child relationship - I'm not sure if that makes a difference.
> 
> I am using ES 0.20.6.
> 
> I'm a bit stuck - and this only seems to be for terms which I've used the  
> Java update API. I also can't think of any reasons why a query in ES Head  
> would return different results than the same query executed via Java API.
> 
> Thanks
> 
> Grant
> 
> --  
> Grant Gochnauer | Vodori Inc | [grant.gochnauer@vodori.com](mailto:grant.gochnauer@vodori.com) | (w)  
> 312.324.0124 | (c) 312.504.5004

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![grantgochnauer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/grantgochnauer/32/2300_2.png) [@grantgochnauer](https://discuss.elastic.co/u/grantgochnauer)\
**Post date:** [June 4, 2013, 8:52pm UTC](https://discuss.elastic.co/t/query-returns-results-in-es-head-but-not-java-api-after-using-update-api/12261/3 "2013-06-04T20:52:07Z")

</div>

I actually ended up fixing this - turns out the Java API was correct - I  
had a bad value in my inbox. For some reason ES Head was returning a match  
when it should not have.

In any case, problem solved 😉

Grant

On Tuesday, June 4, 2013 1:32:05 PM UTC-5, Grant Gochnauer wrote:

> So I started tweaking my query in JAVA, and now I have a query that works  
> in JAVA too but it's strange why it's working. I simply removed the nested  
> filter on path. Here is the working query (although now incomplete):
> 
> [Working ES query when excluding nested call · GitHub](https://gist.github.com/GrantGochnauer/5708260)
> 
> It's strange that the original query works in ES Head but not in JAVA API  
> and then when I remove the nested filter, it works in JAVA.
> 
> Grant
> 
> On Tuesday, June 4, 2013 12:46:10 PM UTC-5, Grant Gochnauer wrote:
> 
> > Hello ES folks --
> > 
> > I'm running into an interesting inconsistency (or so it appears) between  
> > the same query executed via Elasticsearch Head and the client java API  
> > where the query in ES Head returns results as expected but using the Java  
> > API, no results are returned. At first I thought it was simply something  
> > I'm doing in the JAVA API (i.e. restricting class names or something that  
> > you do in the Java API you don't do in ES Head) but after triple checking  
> > these, I cannot find the difference.
> > 
> > I suspect it may have to do with how I'm using the java update API on the  
> > new value I'm filtering on but can't be sure.
> > 
> > When the index is created, this model is added:
> > 
> > [Sample ES Model for List question · GitHub](https://gist.github.com/GrantGochnauer/5707877)
> > 
> > When I run the following query in ES Head, it works:
> > 
> > [Query which is failing · GitHub](https://gist.github.com/GrantGochnauer/5707892)
> > 
> > The same query via the ES Java API (as seen as logging to our console)  
> > returns 0 results. This was the query I copied and pasted in ES Head.
> > 
> > The only thing I can think of is that the value that isn't filtering  
> > properly in the java api is "altNames" which when I remove the term filter,  
> > values come back. I added the value to altNames in the index  
> > by calling the update route in the java api.
> > 
> > Is it possible this is an issue with "versions" of the same document? In  
> > ES Head, the \_version value is 3. This object also is the parent of a  
> > parent/child relationship - I'm not sure if that makes a difference.
> > 
> > I am using ES 0.20.6.
> > 
> > I'm a bit stuck - and this only seems to be for terms which I've used the  
> > Java update API. I also can't think of any reasons why a query in ES Head  
> > would return different results than the same query executed via Java API.
> > 
> > Thanks
> > 
> > Grant
> > 
> > --  
> > Grant Gochnauer | Vodori Inc | [grant.gochnauer@vodori.com](mailto:grant.gochnauer@vodori.com) | (w)  
> > 312.324.0124 | (c) 312.504.5004

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:33am UTC](https://discuss.elastic.co/t/query-returns-results-in-es-head-but-not-java-api-after-using-update-api/12261/4 "2017-07-06T02:33:01Z")

</div>


