Problem retrieving record with geo_point in a subfield

Hello,

We are trying to index geographic coordinates present in a subfield, and
can't make it work.

Here is the code to reproduce:

https://gist.github.com/3896214

The last http request is the search query (on location.coord) that returns
0 result.
The query before that is on the field location2, which returns one result
as expected.

Could be related to this issue:

https://groups.google.com/forum/?fromgroups=#!topicsearchin/elasticsearch/global$20geo/elasticsearch/CCg58v2cFy4

Any help would be great!

Thanks!

Martin

--

Hi Martin,

I did not run your test case but I'm wondering if after the doc insertion, you see something like "update mappings" in logs?
When you get the mapping back, what can you see?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 oct. 2012 à 01:33, Martin Jambon mjambon@gmail.com a écrit :

Hello,

We are trying to index geographic coordinates present in a subfield, and can't make it work.

Here is the code to reproduce:

https://gist.github.com/3896214

The last http request is the search query (on location.coord) that returns 0 result.
The query before that is on the field location2, which returns one result as expected.

Could be related to this issue:

https://groups.google.com/forum/?fromgroups=#!topicsearchin/elasticsearch/global$20geo/elasticsearch/CCg58v2cFy4

Any help would be great!

Thanks!

Martin

--

--

On 10/15/2012 05:23 PM, David Pilato wrote:

Hi Martin,

I did not run your test case but I'm wondering if after the doc
insertion, you see something like "update mappings" in logs?

I see that:

[2012-10-15 17:43:36,704][INFO ][cluster.metadata ] [Wendigo] [test1350348216] creating index, cause [api], shards [5]/[1], mappings [doc]
[2012-10-15 17:43:37,825][INFO ][cluster.metadata ] [Wendigo] [test1350348216] update_mapping [doc] (dynamic)

When you get the mapping back, what can you see?

A freshly created index gives me this:

$ curl -XGET "http://127.0.0.1:9200/test1350348216/doc/_mapping?pretty=true"
{
"doc" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"location.coord" : {
"type" : "geo_point",
"lat_lon" : true
},
"location2" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}
}

But after posting the first document, I get this:

$ curl -XGET 'http://127.0.0.1:9200/test1350348216/doc/_mapping?pretty=true'
{
"doc" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"location" : {
"dynamic" : "true",
"properties" : {
"coord" : {
"dynamic" : "true",
"properties" : {
"lat" : {
"type" : "long",
"ignore_malformed" : false
},
"lon" : {
"type" : "long",
"ignore_malformed" : false
}
}
}
}
},
"location.coord" : {
"type" : "geo_point",
"lat_lon" : true
},
"location2" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}

It looks as if the lack of declaration of the "location" field resulted in an interpretation that ignores the declaration of "location.coord" as soon as a document is posted.

Martin

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 oct. 2012 à 01:33, Martin Jambon <mjambon@gmail.com
mailto:mjambon@gmail.com> a écrit :

Hello,

We are trying to index geographic coordinates present in a subfield, and
can't make it work.

Here is the code to reproduce:

elasticsearch not indexing/finding geo_point in a subfield · GitHub

The last http request is the search query (on location.coord) that
returns 0 result.
The query before that is on the field location2, which returns one
result as expected.

Could be related to this issue:

Redirecting to Google Groups

Any help would be great!

Thanks!

Martin

--

--

--

Yes. That what I had in mind.
I think that your mapping is incorrect.

You should define location as an object with a field coord: Elasticsearch Platform — Find real-time answers at scale | Elastic

My 2 cents

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 oct. 2012 à 03:03, Martin Jambon mjambon@gmail.com a écrit :

On 10/15/2012 05:23 PM, David Pilato wrote:

Hi Martin,

I did not run your test case but I'm wondering if after the doc
insertion, you see something like "update mappings" in logs?

I see that:

[2012-10-15 17:43:36,704][INFO ][cluster.metadata ] [Wendigo] [test1350348216] creating index, cause [api], shards [5]/[1], mappings [doc]
[2012-10-15 17:43:37,825][INFO ][cluster.metadata ] [Wendigo] [test1350348216] update_mapping [doc] (dynamic)

When you get the mapping back, what can you see?

A freshly created index gives me this:

$ curl -XGET "http://127.0.0.1:9200/test1350348216/doc/_mapping?pretty=true"
{
"doc" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"location.coord" : {
"type" : "geo_point",
"lat_lon" : true
},
"location2" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}
}

But after posting the first document, I get this:

$ curl -XGET 'http://127.0.0.1:9200/test1350348216/doc/_mapping?pretty=true'
{
"doc" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"location" : {
"dynamic" : "true",
"properties" : {
"coord" : {
"dynamic" : "true",
"properties" : {
"lat" : {
"type" : "long",
"ignore_malformed" : false
},
"lon" : {
"type" : "long",
"ignore_malformed" : false
}
}
}
}
},
"location.coord" : {
"type" : "geo_point",
"lat_lon" : true
},
"location2" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}

It looks as if the lack of declaration of the "location" field resulted in an interpretation that ignores the declaration of "location.coord" as soon as a document is posted.

Martin

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 oct. 2012 à 01:33, Martin Jambon <mjambon@gmail.com
mailto:mjambon@gmail.com> a écrit :

Hello,

We are trying to index geographic coordinates present in a subfield, and
can't make it work.

Here is the code to reproduce:

elasticsearch not indexing/finding geo_point in a subfield · GitHub

The last http request is the search query (on location.coord) that
returns 0 result.
The query before that is on the field location2, which returns one
result as expected.

Could be related to this issue:

Redirecting to Google Groups

Any help would be great!

Thanks!

Martin

--

--

--

--

That's it!
Thanks a lot.

The following creates an index with a proper mapping for location.coord
of type {lat: ..., lon: ...}:

curl -XPUT http://127.0.0.1:9200/$index -d '{
"mappings": {
"doc": {
"properties": {
"id": { "type": "string", "index": "not_analyzed" },
"location": {
"properties": {
"coord": { "type": "geo_point", "lat_lon": true }
}
},
"location2": { "type": "geo_point", "lat_lon": true }
}
}
}
}
'

On 10/15/2012 06:21 PM, David Pilato wrote:

Yes. That what I had in mind.
I think that your mapping is incorrect.

You should define location as an object with a field coord:
Elasticsearch Platform — Find real-time answers at scale | Elastic

My 2 cents

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 oct. 2012 à 03:03, Martin Jambon <mjambon@gmail.com
mailto:mjambon@gmail.com> a écrit :

On 10/15/2012 05:23 PM, David Pilato wrote:

Hi Martin,

I did not run your test case but I'm wondering if after the doc
insertion, you see something like "update mappings" in logs?

I see that:

[2012-10-15 17:43:36,704][INFO ][cluster.metadata ] [Wendigo]
[test1350348216] creating index, cause [api], shards [5]/[1], mappings [doc]
[2012-10-15 17:43:37,825][INFO ][cluster.metadata ] [Wendigo]
[test1350348216] update_mapping [doc] (dynamic)

When you get the mapping back, what can you see?

A freshly created index gives me this:

$ curl -XGET "http://127.0.0.1:9200/test1350348216/doc/_mapping?pretty=true"
{
"doc" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"location.coord" : {
"type" : "geo_point",
"lat_lon" : true
},
"location2" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}
}

But after posting the first document, I get this:

$ curl -XGET 'http://127.0.0.1:9200/test1350348216/doc/_mapping?pretty=true'
{
"doc" : {
"properties" : {
"id" : {
"type" : "string",
"index" : "not_analyzed"
},
"location" : {
"dynamic" : "true",
"properties" : {
"coord" : {
"dynamic" : "true",
"properties" : {
"lat" : {
"type" : "long",
"ignore_malformed" : false
},
"lon" : {
"type" : "long",
"ignore_malformed" : false
}
}
}
}
},
"location.coord" : {
"type" : "geo_point",
"lat_lon" : true
},
"location2" : {
"type" : "geo_point",
"lat_lon" : true
}
}
}

It looks as if the lack of declaration of the "location" field resulted
in an interpretation that ignores the declaration of "location.coord" as
soon as a document is posted.

Martin

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 16 oct. 2012 à 01:33, Martin Jambon <mjambon@gmail.com
mailto:mjambon@gmail.com
mailto:mjambon@gmail.com> a écrit :

Hello,

We are trying to index geographic coordinates present in a subfield, and
can't make it work.

Here is the code to reproduce:

elasticsearch not indexing/finding geo_point in a subfield · GitHub

The last http request is the search query (on location.coord) that
returns 0 result.
The query before that is on the field location2, which returns one
result as expected.

Could be related to this issue:

Redirecting to Google Groups

Any help would be great!

Thanks!

Martin

--

--

--

--

--