Running Lucene Queries

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);

--

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);

--

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);

--

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 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
(filterBuilder)
.setQuery(queryBuilder).execut
e().actionGet(timeout);

--

--

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 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.comwrote:

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(filterBuilder)
.setQuery(queryBuilder).execut
e().actionGet(timeout);

--

--

--

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 <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<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(filterBuilder)
.setQuery(queryBuilder).execut
e().actionGet(timeout);

--

--

--

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 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 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 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").
setOperationThreading(SearchOperationThreading.NO**_THREADS**).
setFilter(filterBuil**der)
.setQuery(queryBuilder).execut****e().actionGet(timeout);

--

--

--

--

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<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 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.comwrote:

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"
).setOperationThreading(SearchOperationThreading.NO**_THREADS**
).setFilter(filterBuil**der)
.setQuery(queryBuilder).execut****e().actionGet(timeout);

--

--

--

--

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 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 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.comwrote:

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"
).setOperationThreading(SearchOperationThreading.NO**_THREADS**
).setFilter(filterBuil**der)
.setQuery(queryBuilder).execut****e().actionGet(timeout);

--

--

--

--