Geo_shapes and geo queries - can't figure out how to use them

i've been using elasticsearch a few months now to index regular data. Now i
want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i run
the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

0.90 beta is not in the best of state regarding geo_shape. I'm using a
trunk snapshot. Anything from this week will include lucene 4.2 with some
improvements regarding especially accuracy.

Another thing to be aware of is that the documentation is for stable and
somewhat outdated since there have been a change: intersects is now the
only supported relation for queries. Within no longer works.

In any case, the query looks fine except for the matchall.
Try "query":{"match_all":{}}

Jilles

On Wednesday, March 13, 2013 12:14:09 PM UTC+1, Martin Bažík wrote:

i've been using elasticsearch a few months now to index regular data. Now
i want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here
https://gist.github.com/bazo/5143339

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i run
the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

thanks for the reply.

in which version are polygons supported?

have tried to save the following polygon in both 0.20.5 and 0.90beta(dont
know how to compile the master source).

mapping:

{
"polygon": {
"properties": {
"location": {
"type": "geo_shape"
}
}
}
}

the polygon document:

{
"location": {
"type": "polygon",
"coordinates": [
[
48.2,
17.1
],
[
48.4,
17.6
],
[
48.9,
18
],
[
49.2,
18.7
],
[
48.7,
21.3
],
[
48.2,
17.1
]
]
}
}

i get 'MapperParsingException[Failed to parse [location]]; nested:
NullPointerException

so far i havent been able to save any shape.

my use is to save a bunch of polygons and then query intersecting polygons
with a user given one.

but so far i can't make heads or tails of it

Dňa štvrtok, 14. marca 2013 14:58:54 UTC+1 Jilles van Gurp napísal(-a):

Hey,

0.90 beta is not in the best of state regarding geo_shape. I'm using a
trunk snapshot. Anything from this week will include lucene 4.2 with some
improvements regarding especially accuracy.

Another thing to be aware of is that the documentation is for stable and
somewhat outdated since there have been a change: intersects is now the
only supported relation for queries. Within no longer works.

In any case, the query looks fine except for the matchall.
Try "query":{"match_all":{}}

Jilles

On Wednesday, March 13, 2013 12:14:09 PM UTC+1, Martin Bažík wrote:

i've been using elasticsearch a few months now to index regular data. Now
i want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here
https://gist.github.com/bazo/5143339

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i
run the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

You are running in the same problem I was running into a couple of weeks
ago: polygons are 3d arrays, not 2d arrays. The semantics is that the first
element is the polygon and subsequent elements define holes in the polygon.

Additionally, the convention is to capitalize the type, so Polygon instead
of polygon.

Both are geojson related things that you have to be aware of to figure it
out.

Jilles

On Wednesday, March 13, 2013 12:14:09 PM UTC+1, Martin Bažík wrote:

i've been using elasticsearch a few months now to index regular data. Now
i want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here
https://gist.github.com/bazo/5143339

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i run
the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Btw. compilation is pretty easy if you know how to use maven.

If not, install maven 3.x, make sure it is on your path (run maven -version
to check)

Then checkout the github project for elastic search and in the root type
mvn clean install -DskipTests=true

Skipping the tests is usually a good idea because they take quite a bit of
time to run.

That should compile things and create distribution packages in the target
dir.

Jilles

On Wednesday, March 13, 2013 12:14:09 PM UTC+1, Martin Bažík wrote:

i've been using elasticsearch a few months now to index regular data. Now
i want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here
https://gist.github.com/bazo/5143339

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i run
the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

i tried both polygon and Polygon, there was no difference.

now i see, that i miss one nested array. there's so mnay brackets :slight_smile:

i will tri it right now.

i have never used maven before, can i compile es also on windows?

Dňa štvrtok, 14. marca 2013 17:20:37 UTC+1 Jilles van Gurp napísal(-a):

Btw. compilation is pretty easy if you know how to use maven.

If not, install maven 3.x, make sure it is on your path (run maven
-version to check)

Then checkout the github project for elastic search and in the root type
mvn clean install -DskipTests=true

Skipping the tests is usually a good idea because they take quite a bit of
time to run.

That should compile things and create distribution packages in the target
dir.

Jilles

On Wednesday, March 13, 2013 12:14:09 PM UTC+1, Martin Bažík wrote:

i've been using elasticsearch a few months now to index regular data. Now
i want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here
https://gist.github.com/bazo/5143339

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i
run the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

It should work on windows, barring platform specific issues with packaging
perhaps.

Jilles

On Thursday, March 14, 2013 6:28:24 PM UTC+1, Martin Bažík wrote:

i tried both polygon and Polygon, there was no difference.

now i see, that i miss one nested array. there's so mnay brackets :slight_smile:

i will tri it right now.

i have never used maven before, can i compile es also on windows?

Dňa štvrtok, 14. marca 2013 17:20:37 UTC+1 Jilles van Gurp napísal(-a):

Btw. compilation is pretty easy if you know how to use maven.

If not, install maven 3.x, make sure it is on your path (run maven
-version to check)

Then checkout the github project for elastic search and in the root type
mvn clean install -DskipTests=true

Skipping the tests is usually a good idea because they take quite a bit
of time to run.

That should compile things and create distribution packages in the target
dir.

Jilles

On Wednesday, March 13, 2013 12:14:09 PM UTC+1, Martin Bažík wrote:

i've been using elasticsearch a few months now to index regular data.
Now i want to index some geospatial data, but can't figure it out.

i'm using elasticsearch 0.90 beta

the documents and query definition can be seen here
https://gist.github.com/bazo/5143339

the second document and query are taken from documentation examples. i'm
not sure whether location is a required name or some special property or i
can name the field anyhow i want.

the mapping looks like this

test: {

properties: {

location: {

  type: geo_shape

}

}

}

when i run the query i get a Parse Failure [Failed to parse source
[{"query":{"filtered":{"query":{"match_all":[]},"filter":{"geo_shape":{"location":{"shape":{"type":"envelope","coordinates":[[45,17],[49,18]]},"relation":"within"}}}}},"from":0,"size":15}]]];
nested: IllegalArgumentException[no terms provided]; }]'

geo is the name of the index. the filter must be wrong, because when i
run the query without the filter i get a list of all documents stored

what am i doing wrong and how i can fix it?

thanks

--
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.
For more options, visit https://groups.google.com/groups/opt_out.