# Running Lucene Queries

**URL:** https://discuss.elastic.co/t/running-lucene-queries/10253
**Category:** Elasticsearch
**Created:** [January 7, 2013, 6:00pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253 "2013-01-07T18:00:43Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Ahmed\_Yehia](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ahmed\_Yehia](https://discuss.elastic.co/u/Ahmed_Yehia)
#### Post date: [January 7, 2013, 6:00pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/1 "2013-01-07T18:00:43Z")

</div>

Hi,

I 'm looking into executing a Lucene query, along a geo\_point search  
request.  
Documents appear in the index like so:

\_source: {  
pin: {  
id: 1  
location: {  
lat: 45.706180572509766,  
lon: 3.603515625  
}  
},  
info: {  
extra: {  
field1: "value1",  
field2 : 100  
}  
}  
}

With this mapping:

mappings: {  
pin: {  
properties: {  
id: {  
store: yes  
type: long  
}  
location: {  
lat\_lon: true  
type: geo\_point  
}}}}

I 'm looking at query\_string which seems the most relevant to this case.  
The following code attempts to make this call, but it doesn't succeed when  
setting 'queryBuilder' along the request:

QueryBuilder queryBuilder = QueryBuilders.queryString("info.extra.field1:"value1"  
AND info.extra.field2:\>200");  
FilterBuilder filterBuilder = // init boundingBox filter

SearchResponse searchResponse = client.prepareSearch("geoIndex").  
setOperationThreading(SearchOperationThreading.NO\_THREADS).setFilter(  
filterBuilder)  
.setQuery(queryBuilder).execute().actionGet(timeout);

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [January 8, 2013, 4:03am UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/2 "2013-01-08T04:03:13Z")

</div>

Try this:

QueryBuilder queryBuilder = QueryBuilders.queryString("info.extra.field1:"value1"  
AND info.extra.field2:[200 TO \*]");

On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:

> Hi,
> 
> I 'm looking into executing a Lucene query, along a geo\_point search  
> request.  
> Documents appear in the index like so:
> 
> \_source: {  
> pin: {  
> id: 1  
> location: {  
> lat: 45.706180572509766,  
> lon: 3.603515625  
> }  
> },  
> info: {  
> extra: {  
> field1: "value1",  
> field2 : 100  
> }  
> }  
> }
> 
> With this mapping:
> 
> mappings: {  
> pin: {  
> properties: {  
> id: {  
> store: yes  
> type: long  
> }  
> location: {  
> lat\_lon: true  
> type: geo\_point  
> }}}}
> 
> I 'm looking at query\_string which seems the most relevant to this case.  
> The following code attempts to make this call, but it doesn't succeed when  
> setting 'queryBuilder' along the request:
> 
> QueryBuilder queryBuilder = QueryBuilders.queryString("info.extra.field1:"value1"  
> AND info.extra.field2:\>200");  
> FilterBuilder filterBuilder = // init boundingBox filter
> 
> SearchResponse searchResponse = client.prepareSearch("geoIndex").  
> setOperationThreading(SearchOperationThreading.NO\_THREADS).setFilter(  
> filterBuilder)  
> .setQuery(queryBuilder).execute().actionGet(timeout);

--

---

<div class="post-metadata">

### Author: ![Ahmed\_Yehia](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ahmed\_Yehia](https://discuss.elastic.co/u/Ahmed_Yehia)
#### Post date: [January 8, 2013, 6:06pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/3 "2013-01-08T18:06:47Z")

</div>

Thanks for response.  
The issue appears elsewhere, it throws a parse exception:

Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{  
"query\_string":{"query":"info.extra.field1:value1"}},"query\_binary":"ZQ==",  
"filter":{"geo\_bbox":{"location":{"top\_left":[0.087890625,69.2249968541159],  
"bottom\_right":[39.462890625,59.977005492196]}}}}]]];

On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:

> Try this:
> 
> QueryBuilder queryBuilder = QueryBuilders.queryString("info.extra.field1:"value1"  
> AND info.extra.field2:[200 TO \*]");
> 
> On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> 
> > Hi,
> > 
> > I 'm looking into executing a Lucene query, along a geo\_point search  
> > request.  
> > Documents appear in the index like so:
> > 
> > \_source: {  
> > pin: {  
> > id: 1  
> > location: {  
> > lat: 45.706180572509766,  
> > lon: 3.603515625  
> > }  
> > },  
> > info: {  
> > extra: {  
> > field1: "value1",  
> > field2 : 100  
> > }  
> > }  
> > }
> > 
> > With this mapping:
> > 
> > mappings: {  
> > pin: {  
> > properties: {  
> > id: {  
> > store: yes  
> > type: long  
> > }  
> > location: {  
> > lat\_lon: true  
> > type: geo\_point  
> > }}}}
> > 
> > I 'm looking at query\_string which seems the most relevant to this case.  
> > The following code attempts to make this call, but it doesn't succeed  
> > when setting 'queryBuilder' along the request:
> > 
> > QueryBuilder queryBuilder = QueryBuilders.queryString("info.extra.field1:"value1"  
> > AND info.extra.field2:\>200");  
> > FilterBuilder filterBuilder = // init boundingBox filter
> > 
> > SearchResponse searchResponse = client.prepareSearch("geoIndex").  
> > setOperationThreading(SearchOperationThreading.NO\_THREADS).setFilter(  
> > filterBuilder)  
> > .setQuery(queryBuilder).execute().actionGet(timeout);

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [January 8, 2013, 6:59pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/4 "2013-01-08T18:59:11Z")

</div>

Could you try the following query and post here complete error message  
(preferably from elasticsearch log)

client.prepareSearch("geoIndex")

.setQuery(QueryBuilders.filteredQuery(QueryBuilders.queryString("info.extra.field1:value1"),

FilterBuilders.geoBoundingBoxFilter("location").topLeft(69.2249968541159,0.087890625).bottomRight(59.977005492196,39.462890625)))  
.execute().actionGet();

On Tue, Jan 8, 2013 at 1:06 PM, Ahmed Yehia [ahmed.yehia.m@gmail.com](mailto:ahmed.yehia.m@gmail.com) wrote:

> Thanks for response.  
> The issue appears elsewhere, it throws a parse exception:
> 
> Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{  
> "query\_string":{"query":"info.extra.field1:value1"}},"query\_binary":"ZQ=="  
> ,"filter":{"geo\_bbox":{"location":{"top\_left":[0.087890625,  
> 69.2249968541159],"bottom\_right":[39.462890625,59.977005492196]}}}}]]];
> 
> On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:
> 
> > Try this:
> > 
> > QueryBuilder queryBuilder = Qu\*\*eryBuilders.queryString("info.\*\*extra.field1:"value1"  
> > AND info.extra.field2:[200 TO \*]");
> > 
> > On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> > 
> > > Hi,
> > > 
> > > I 'm looking into executing a Lucene query, along a geo\_point search  
> > > request.  
> > > Documents appear in the index like so:
> > > 
> > > \_source: {  
> > > pin: {  
> > > id: 1  
> > > location: {  
> > > lat: 45.706180572509766,  
> > > lon: 3.603515625  
> > > }  
> > > },  
> > > info: {  
> > > extra: {  
> > > field1: "value1",  
> > > field2 : 100  
> > > }  
> > > }  
> > > }
> > > 
> > > With this mapping:
> > > 
> > > mappings: {  
> > > pin: {  
> > > properties: {  
> > > id: {  
> > > store: yes  
> > > type: long  
> > > }  
> > > location: {  
> > > lat\_lon: true  
> > > type: geo\_point  
> > > }}}}
> > > 
> > > I 'm looking at query\_string which seems the most relevant to this case.  
> > > The following code attempts to make this call, but it doesn't succeed  
> > > when setting 'queryBuilder' along the request:
> > > 
> > > QueryBuilder queryBuilder = QueryBuilders.queryString("\*\*info.extra.field1:"value1"  
> > > AND info.extra.field2:\>200");  
> > > FilterBuilder filterBuilder = // init boundingBox filter
> > > 
> > > SearchResponse searchResponse = client.prepareSearch("**geoIndex").  
> > > setOperationThreadi**ng(SearchOperationThreading.NO\*\*\_THREADS).setFilter  
> > > (filterBuil**der)  
> > > .setQuery(queryBuilder).execut**e().actionGet(timeout);
> > > 
> > > --

--

---

<div class="post-metadata">

### Author: ![Ahmed\_Yehia](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ahmed\_Yehia](https://discuss.elastic.co/u/Ahmed_Yehia)
#### Post date: [January 9, 2013, 11:16pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/5 "2013-01-09T23:16:01Z")

</div>

This query doesn't seem to log any errors, it ran quietly and yields no  
result.  
testing on ES v 0.19.11

On Tue, Jan 8, 2013 at 8:59 PM, Igor Motov [igor@motovs.org](mailto:igor@motovs.org) wrote:

> Could you try the following query and post here complete error message  
> (preferably from elasticsearch log)
> 
> client.prepareSearch("geoIndex")
> 
> .setQuery(QueryBuilders.filteredQuery(QueryBuilders.queryString("info.extra.field1:value1"),
> 
> FilterBuilders.geoBoundingBoxFilter("location").topLeft(69.2249968541159,0.087890625).bottomRight(59.977005492196,39.462890625)))  
> .execute().actionGet();
> 
> On Tue, Jan 8, 2013 at 1:06 PM, Ahmed Yehia [ahmed.yehia.m@gmail.com](mailto:ahmed.yehia.m@gmail.com)wrote:
> 
> > Thanks for response.  
> > The issue appears elsewhere, it throws a parse exception:
> > 
> > Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{  
> > "query\_string":{"query":"info.extra.field1:value1"}},"query\_binary":  
> > "ZQ==","filter":{"geo\_bbox":{"location":{"top\_left":[0.087890625,  
> > 69.2249968541159],"bottom\_right":[39.462890625,59.977005492196]}}}}]]];
> > 
> > On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:
> > 
> > > Try this:
> > > 
> > > QueryBuilder queryBuilder = Qu\*\*eryBuilders.queryString("info.\*\*extra.field1:"value1"  
> > > AND info.extra.field2:[200 TO \*]");
> > > 
> > > On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I 'm looking into executing a Lucene query, along a geo\_point search  
> > > > request.  
> > > > Documents appear in the index like so:
> > > > 
> > > > \_source: {  
> > > > pin: {  
> > > > id: 1  
> > > > location: {  
> > > > lat: 45.706180572509766,  
> > > > lon: 3.603515625  
> > > > }  
> > > > },  
> > > > info: {  
> > > > extra: {  
> > > > field1: "value1",  
> > > > field2 : 100  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > With this mapping:
> > > > 
> > > > mappings: {  
> > > > pin: {  
> > > > properties: {  
> > > > id: {  
> > > > store: yes  
> > > > type: long  
> > > > }  
> > > > location: {  
> > > > lat\_lon: true  
> > > > type: geo\_point  
> > > > }}}}
> > > > 
> > > > I 'm looking at query\_string which seems the most relevant to this case.  
> > > > The following code attempts to make this call, but it doesn't succeed  
> > > > when setting 'queryBuilder' along the request:
> > > > 
> > > > QueryBuilder queryBuilder = QueryBuilders.queryString("\*\*info.extra.field1:"value1"  
> > > > AND info.extra.field2:\>200");  
> > > > FilterBuilder filterBuilder = // init boundingBox filter
> > > > 
> > > > SearchResponse searchResponse = client.prepareSearch("**geoIndex").  
> > > > setOperationThreadi**ng(SearchOperationThreading.NO\*\*\_THREADS).  
> > > > setFilter(filterBuil**der)  
> > > > .setQuery(queryBuilder).execut**e().actionGet(timeout);
> > > > 
> > > > --
> 
> --

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [January 9, 2013, 11:28pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/6 "2013-01-09T23:28:07Z")

</div>

Make sure that bounding boxes are correct. The top left and bottom right  
corners are specified as (lon, lat).

On Wednesday, January 9, 2013 6:16:01 PM UTC-5, Ahmed Yehia wrote:

> This query doesn't seem to log any errors, it ran quietly and yields no  
> result.  
> testing on ES v 0.19.11
> 
> On Tue, Jan 8, 2013 at 8:59 PM, Igor Motov \<[ig...@motovs.org](mailto:ig...@motovs.org) \<javascript:\>
> 
> > wrote:
> 
> > Could you try the following query and post here complete error message  
> > (preferably from elasticsearch log)
> > 
> > client.prepareSearch("geoIndex")
> > 
> > .setQuery(QueryBuilders.filteredQuery(QueryBuilders.queryString("info.extra.field1:value1"),
> > 
> > FilterBuilders.geoBoundingBoxFilter("location").topLeft(69.2249968541159,0.087890625).bottomRight(59.977005492196,39.462890625)))  
> > .execute().actionGet();
> > 
> > On Tue, Jan 8, 2013 at 1:06 PM, Ahmed Yehia \<[ahmed....@gmail.com](mailto:ahmed....@gmail.com)\<javascript:\>
> > 
> > > wrote:
> > 
> > > Thanks for response.  
> > > The issue appears elsewhere, it throws a parse exception:
> > > 
> > > Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{  
> > > "query\_string":{"query":"info.extra.field1:value1"}},"query\_binary":  
> > > "ZQ==","filter":{"geo\_bbox":{"location":{"top\_left":[0.087890625,  
> > > 69.2249968541159],"bottom\_right":[39.462890625,59.977005492196]}}}}]]];
> > > 
> > > On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:
> > > 
> > > > Try this:
> > > > 
> > > > QueryBuilder queryBuilder = Qu\*\*eryBuilders.queryString("info.\*\*extra.field1:"value1"  
> > > > AND info.extra.field2:[200 TO \*]");
> > > > 
> > > > On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I 'm looking into executing a Lucene query, along a geo\_point search  
> > > > > request.  
> > > > > Documents appear in the index like so:
> > > > > 
> > > > > \_source: {  
> > > > > pin: {  
> > > > > id: 1  
> > > > > location: {  
> > > > > lat: 45.706180572509766,  
> > > > > lon: 3.603515625  
> > > > > }  
> > > > > },  
> > > > > info: {  
> > > > > extra: {  
> > > > > field1: "value1",  
> > > > > field2 : 100  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > With this mapping:
> > > > > 
> > > > > mappings: {  
> > > > > pin: {  
> > > > > properties: {  
> > > > > id: {  
> > > > > store: yes  
> > > > > type: long  
> > > > > }  
> > > > > location: {  
> > > > > lat\_lon: true  
> > > > > type: geo\_point  
> > > > > }}}}
> > > > > 
> > > > > I 'm looking at query\_string which seems the most relevant to this  
> > > > > case.  
> > > > > The following code attempts to make this call, but it doesn't succeed  
> > > > > when setting 'queryBuilder' along the request:
> > > > > 
> > > > > QueryBuilder queryBuilder = QueryBuilders.queryString("\*\*info.extra.field1:"value1"  
> > > > > AND info.extra.field2:\>200");  
> > > > > FilterBuilder filterBuilder = // init boundingBox filter
> > > > > 
> > > > > SearchResponse searchResponse = client.prepareSearch("**geoIndex").  
> > > > > setOperationThreadi**ng(SearchOperationThreading.NO\*\*\_THREADS).  
> > > > > setFilter(filterBuil**der)  
> > > > > .setQuery(queryBuilder).execut**e().actionGet(timeout);
> > > > > 
> > > > > --
> > 
> > --

--

---

<div class="post-metadata">

### Author: ![Ahmed\_Yehia](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ahmed\_Yehia](https://discuss.elastic.co/u/Ahmed_Yehia)
#### Post date: [January 10, 2013, 1:48pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/7 "2013-01-10T13:48:44Z")

</div>

Hi Igor,

Still no luck with the query, it just ran w/o any error or result.

On Thu, Jan 10, 2013 at 1:28 AM, Igor Motov [imotov@gmail.com](mailto:imotov@gmail.com) wrote:

> Make sure that bounding boxes are correct. The top left and bottom right  
> corners are specified as (lon, lat).
> 
> On Wednesday, January 9, 2013 6:16:01 PM UTC-5, Ahmed Yehia wrote:
> 
> > This query doesn't seem to log any errors, it ran quietly and yields no  
> > result.  
> > testing on ES v 0.19.11
> > 
> > On Tue, Jan 8, 2013 at 8:59 PM, Igor Motov [ig...@motovs.org](mailto:ig...@motovs.org) wrote:
> > 
> > > Could you try the following query and post here complete error message  
> > > (preferably from elasticsearch log)
> > > 
> > > client.prepareSearch("\*\*geoIndex")  
> > > .setQuery(QueryBuilders.**filteredQuery(QueryBuilders.**  
> > > queryString("info.extra.\*\*field1:value1"),  
> > > FilterBuilders.**geoBoundingBoxFilter("**  
> > > location").topLeft(69.**2249968541159,0.087890625).**  
> > > bottomRight(59.977005492196,\*\*39.462890625)))  
> > > .execute().actionGet();
> > > 
> > > On Tue, Jan 8, 2013 at 1:06 PM, Ahmed Yehia [ahmed....@gmail.com](mailto:ahmed....@gmail.com) wrote:
> > > 
> > > > Thanks for response.  
> > > > The issue appears elsewhere, it throws a parse exception:
> > > > 
> > > > Parse Failure [Failed to parse source [{"from":0,"size":100,"query":\*\*{  
> > > > "query\_string":{"query":"\*\*info.extra.field1:value1"}},"**query\_binary"  
> > > > :"ZQ==","filter": **{"geo\_bbox":{"location":{"top\_** left":[0.087890625,  
> > > > 69.2249968541159],"bottom\_right":[39.462890625,59.977005492196]**  
> > > > }}}}]]];
> > > > 
> > > > On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:
> > > > 
> > > > > Try this:
> > > > > 
> > > > > QueryBuilder queryBuilder = Qu\*\*\*\*eryBuilders.queryString("info.\*\*\*\*extra.field1:"value1"  
> > > > > AND info.extra.field2:[200 TO \*]");
> > > > > 
> > > > > On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I 'm looking into executing a Lucene query, along a geo\_point search  
> > > > > > request.  
> > > > > > Documents appear in the index like so:
> > > > > > 
> > > > > > \_source: {  
> > > > > > pin: {  
> > > > > > id: 1  
> > > > > > location: {  
> > > > > > lat: 45.706180572509766,  
> > > > > > lon: 3.603515625  
> > > > > > }  
> > > > > > },  
> > > > > > info: {  
> > > > > > extra: {  
> > > > > > field1: "value1",  
> > > > > > field2 : 100  
> > > > > > }  
> > > > > > }  
> > > > > > }
> > > > > > 
> > > > > > With this mapping:
> > > > > > 
> > > > > > mappings: {  
> > > > > > pin: {  
> > > > > > properties: {  
> > > > > > id: {  
> > > > > > store: yes  
> > > > > > type: long  
> > > > > > }  
> > > > > > location: {  
> > > > > > lat\_lon: true  
> > > > > > type: geo\_point  
> > > > > > }}}}
> > > > > > 
> > > > > > I 'm looking at query\_string which seems the most relevant to this  
> > > > > > case.  
> > > > > > The following code attempts to make this call, but it doesn't succeed  
> > > > > > when setting 'queryBuilder' along the request:
> > > > > > 
> > > > > > QueryBuilder queryBuilder = QueryBuilders.queryString(" **inf** o.extra.field1:"value1"  
> > > > > > AND info.extra.field2:\>200");  
> > > > > > FilterBuilder filterBuilder = // init boundingBox filter
> > > > > > 
> > > > > > SearchResponse searchResponse = client.prepareSearch(" **geoIndex**").  
> > > > > > setOperationThreadi**ng(Searc**hOperationThreading.NO\*\*\_THREADS\*\*).  
> > > > > > setFilter(filterBuil\*\*der)  
> > > > > > .setQuery(queryBuilder).execut\*\*\*\*e().actionGet(timeout);
> > > > > > 
> > > > > > --
> > > 
> > > --
> > 
> > --

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [January 10, 2013, 5:41pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/8 "2013-01-10T17:41:42Z")

</div>

I just noticed that "pin" seems to be a type according to mapping, but it's  
also a root object in your source. I think this is what might be causing  
the issue. Run

curl "localhost:9200/geoIndex/\_mapping?pretty=true"

to see what it actually got mapped to. I think that your pin.location field  
isn't mapped as a geo\_point because mapping was expecting "pin" to be type  
and "location" to be in the root of the objects instead of nested in "pin".  
Does it make sense?

On Thursday, January 10, 2013 8:48:44 AM UTC-5, Ahmed Yehia wrote:

> Hi Igor,
> 
> Still no luck with the query, it just ran w/o any error or result.
> 
> On Thu, Jan 10, 2013 at 1:28 AM, Igor Motov \<[imo...@gmail.com](mailto:imo...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Make sure that bounding boxes are correct. The top left and bottom right  
> > corners are specified as (lon, lat).
> > 
> > On Wednesday, January 9, 2013 6:16:01 PM UTC-5, Ahmed Yehia wrote:
> > 
> > > This query doesn't seem to log any errors, it ran quietly and yields no  
> > > result.  
> > > testing on ES v 0.19.11
> > > 
> > > On Tue, Jan 8, 2013 at 8:59 PM, Igor Motov [ig...@motovs.org](mailto:ig...@motovs.org) wrote:
> > > 
> > > > Could you try the following query and post here complete error message  
> > > > (preferably from elasticsearch log)
> > > > 
> > > > client.prepareSearch("\*\*geoIndex")  
> > > > .setQuery(QueryBuilders.\*_filteredQuery(QueryBuilders._  
> > > > \*queryString("info.extra.\*\*field1:value1"),  
> > > > FilterBuilders.**geoBoundingBoxFilter("**  
> > > > location").topLeft(69.**2249968541159,0.087890625).**  
> > > > bottomRight(59.977005492196,\*\*39.462890625)))  
> > > > .execute().actionGet();
> > > > 
> > > > On Tue, Jan 8, 2013 at 1:06 PM, Ahmed Yehia [ahmed....@gmail.com](mailto:ahmed....@gmail.com)wrote:
> > > > 
> > > > > Thanks for response.  
> > > > > The issue appears elsewhere, it throws a parse exception:
> > > > > 
> > > > > Parse Failure [Failed to parse source [{"from":0,"size":100,"query":\*\*  
> > > > > {"query\_string":{"query":" **info.extra.field1:value1"}},"**  
> > > > > query\_binary":"ZQ==","filter":\*\*{"geo\_bbox":{"location":{"top\_**left"  
> > > > > :[0.087890625,69.2249968541159],"bottom\_right":[39.462890625,  
> > > > > 59.977005492196]**}}}}]]];
> > > > > 
> > > > > On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:
> > > > > 
> > > > > > Try this:
> > > > > > 
> > > > > > QueryBuilder queryBuilder = Qu\*\*\*\*eryBuilders.queryString("info.\*\*\*\*extra.field1:"value1"  
> > > > > > AND info.extra.field2:[200 TO \*]");
> > > > > > 
> > > > > > On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I 'm looking into executing a Lucene query, along a geo\_point search  
> > > > > > > request.  
> > > > > > > Documents appear in the index like so:
> > > > > > > 
> > > > > > > \_source: {  
> > > > > > > pin: {  
> > > > > > > id: 1  
> > > > > > > location: {  
> > > > > > > lat: 45.706180572509766,  
> > > > > > > lon: 3.603515625  
> > > > > > > }  
> > > > > > > },  
> > > > > > > info: {  
> > > > > > > extra: {  
> > > > > > > field1: "value1",  
> > > > > > > field2 : 100  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }
> > > > > > > 
> > > > > > > With this mapping:
> > > > > > > 
> > > > > > > mappings: {  
> > > > > > > pin: {  
> > > > > > > properties: {  
> > > > > > > id: {  
> > > > > > > store: yes  
> > > > > > > type: long  
> > > > > > > }  
> > > > > > > location: {  
> > > > > > > lat\_lon: true  
> > > > > > > type: geo\_point  
> > > > > > > }}}}
> > > > > > > 
> > > > > > > I 'm looking at query\_string which seems the most relevant to this  
> > > > > > > case.  
> > > > > > > The following code attempts to make this call, but it doesn't  
> > > > > > > succeed when setting 'queryBuilder' along the request:
> > > > > > > 
> > > > > > > QueryBuilder queryBuilder = QueryBuilders.queryString(" **inf** o.extra.field1:"value1"  
> > > > > > > AND info.extra.field2:\>200");  
> > > > > > > FilterBuilder filterBuilder = // init boundingBox filter
> > > > > > > 
> > > > > > > SearchResponse searchResponse = client.prepareSearch(" **geoIndex**"  
> > > > > > > ).setOperationThreadi**ng(Searc**hOperationThreading.NO\*\*\_THREADS\*\*  
> > > > > > > ).setFilter(filterBuil\*\*der)  
> > > > > > > .setQuery(queryBuilder).execut\*\*\*\*e().actionGet(timeout);
> > > > > > > 
> > > > > > > --
> > > > 
> > > > --
> > > 
> > > --

--

---

<div class="post-metadata">

### Author: ![Ahmed\_Yehia](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ahmed\_Yehia](https://discuss.elastic.co/u/Ahmed_Yehia)
#### Post date: [January 12, 2013, 8:35pm UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/9 "2013-01-12T20:35:20Z")

</div>

yes - the issue was because of the incorrect mapping, after fixing type to  
location instead of pin; the query now runs successfully.  
Thanks for noticing.

Regards

On Thursday, January 10, 2013 7:41:42 PM UTC+2, Igor Motov wrote:

> I just noticed that "pin" seems to be a type according to mapping, but  
> it's also a root object in your source. I think this is what might be  
> causing the issue. Run
> 
> curl "localhost:9200/geoIndex/\_mapping?pretty=true"
> 
> to see what it actually got mapped to. I think that your pin.location  
> field isn't mapped as a geo\_point because mapping was expecting "pin" to be  
> type and "location" to be in the root of the objects instead of nested in  
> "pin". Does it make sense?
> 
> On Thursday, January 10, 2013 8:48:44 AM UTC-5, Ahmed Yehia wrote:
> 
> > Hi Igor,
> > 
> > Still no luck with the query, it just ran w/o any error or result.
> > 
> > On Thu, Jan 10, 2013 at 1:28 AM, Igor Motov [imo...@gmail.com](mailto:imo...@gmail.com) wrote:
> > 
> > > Make sure that bounding boxes are correct. The top left and bottom right  
> > > corners are specified as (lon, lat).
> > > 
> > > On Wednesday, January 9, 2013 6:16:01 PM UTC-5, Ahmed Yehia wrote:
> > > 
> > > > This query doesn't seem to log any errors, it ran quietly and yields no  
> > > > result.  
> > > > testing on ES v 0.19.11
> > > > 
> > > > On Tue, Jan 8, 2013 at 8:59 PM, Igor Motov [ig...@motovs.org](mailto:ig...@motovs.org) wrote:
> > > > 
> > > > > Could you try the following query and post here complete error message  
> > > > > (preferably from elasticsearch log)
> > > > > 
> > > > > client.prepareSearch("\*\*geoIndex")  
> > > > > .setQuery(QueryBuilders.\*\*filteredQuery(QueryBuilders.  
> > > > > \*\*queryString("info.extra.\*\*field1:value1"),  
> > > > > FilterBuilders.**geoBoundingBoxFilter("**  
> > > > > location").topLeft(69.**2249968541159,0.087890625).**  
> > > > > bottomRight(59.977005492196,\*\*39.462890625)))  
> > > > > .execute().actionGet();
> > > > > 
> > > > > On Tue, Jan 8, 2013 at 1:06 PM, Ahmed Yehia [ahmed....@gmail.com](mailto:ahmed....@gmail.com)wrote:
> > > > > 
> > > > > > Thanks for response.  
> > > > > > The issue appears elsewhere, it throws a parse exception:
> > > > > > 
> > > > > > Parse Failure [Failed to parse source [{"from":0,"size":100,"query":\*  
> > > > > > \*{"query\_string":{"query":" **info.extra.field1:value1"}},"**  
> > > > > > query\_binary":"ZQ==","filter":\*\*{"geo\_bbox":{"location":{"top\_**left"  
> > > > > > :[0.087890625,69.2249968541159],"bottom\_right":[39.462890625,  
> > > > > > 59.977005492196]**}}}}]]];
> > > > > > 
> > > > > > On Tuesday, January 8, 2013 6:03:13 AM UTC+2, Igor Motov wrote:
> > > > > > 
> > > > > > > Try this:
> > > > > > > 
> > > > > > > QueryBuilder queryBuilder = Qu\*\*\*\*eryBuilders.queryString("info.\*\*\*\*extra.field1:"value1"  
> > > > > > > AND info.extra.field2:[200 TO \*]");
> > > > > > > 
> > > > > > > On Monday, January 7, 2013 1:00:43 PM UTC-5, Ahmed Yehia wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > I 'm looking into executing a Lucene query, along a geo\_point  
> > > > > > > > search request.  
> > > > > > > > Documents appear in the index like so:
> > > > > > > > 
> > > > > > > > \_source: {  
> > > > > > > > pin: {  
> > > > > > > > id: 1  
> > > > > > > > location: {  
> > > > > > > > lat: 45.706180572509766,  
> > > > > > > > lon: 3.603515625  
> > > > > > > > }  
> > > > > > > > },  
> > > > > > > > info: {  
> > > > > > > > extra: {  
> > > > > > > > field1: "value1",  
> > > > > > > > field2 : 100  
> > > > > > > > }  
> > > > > > > > }  
> > > > > > > > }
> > > > > > > > 
> > > > > > > > With this mapping:
> > > > > > > > 
> > > > > > > > mappings: {  
> > > > > > > > pin: {  
> > > > > > > > properties: {  
> > > > > > > > id: {  
> > > > > > > > store: yes  
> > > > > > > > type: long  
> > > > > > > > }  
> > > > > > > > location: {  
> > > > > > > > lat\_lon: true  
> > > > > > > > type: geo\_point  
> > > > > > > > }}}}
> > > > > > > > 
> > > > > > > > I 'm looking at query\_string which seems the most relevant to this  
> > > > > > > > case.  
> > > > > > > > The following code attempts to make this call, but it doesn't  
> > > > > > > > succeed when setting 'queryBuilder' along the request:
> > > > > > > > 
> > > > > > > > QueryBuilder queryBuilder = QueryBuilders.queryString(" **inf** o.extra.field1:"value1"  
> > > > > > > > AND info.extra.field2:\>200");  
> > > > > > > > FilterBuilder filterBuilder = // init boundingBox filter
> > > > > > > > 
> > > > > > > > SearchResponse searchResponse = client.prepareSearch(" **geoIndex**"  
> > > > > > > > ).setOperationThreadi**ng(Searc**hOperationThreading.NO\*\*\_THREADS\*\*  
> > > > > > > > ).setFilter(filterBuil\*\*der)  
> > > > > > > > .setQuery(queryBuilder).execut\*\*\*\*e().actionGet(timeout);
> > > > > > > > 
> > > > > > > > --
> > > > > 
> > > > > --
> > > > 
> > > > --

--

---

<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:56am UTC](https://discuss.elastic.co/t/running-lucene-queries/10253/10 "2017-07-06T02:56:46Z")

</div>


