Need some help setting up geo indexes

Hello,

I am an elasticsearch noob and am trying to use the wikivoyage index dump (which uses elasticsearch 5.5.2) provided by wikipedia to do some geo queries. After bulk uploading their index in my local instance of elastic I see this in the mappings of the index that gets auto generated
"coordinates" : {
"properties" : {
"coord" : {
"properties" : {
"lat" : {"type" : "float"},
"lon" : {"type" : "float"
}
}
},
"dim" : {
"type" : "long"
},
"globe" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"primary" : {
"type" : "boolean"
}
}
},

Now I want to run the geo distace query based on the example here -
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/query-dsl-geo-distance-query.html

Do I need to do some remapping of the current coordinate field of my index? It looks like I need to create a new geopoint type field or maybe modify the coordinate field to use this geopoint type. Is that right? And any help on how I do that would be greatly appreciated. Thank!

That should be mapped as a geopoint - Geo-point datatype | Elasticsearch Reference [5.5] | Elastic

The best option would be to apply the mapping before uploading the data dump.

Thanks! This is what I ended up doing. It wasn't clear from the docs - after a mapping is autogenerated (via bulk import of data) how to update/fix the mapping.

For something like the full wikipedia index import (where I don't have any prior idea what the fields and types are - and they seem to vary from dump to dump) looks like the process is - create index - figure out what needs changing in mappings - delete index - create new index with new mappings.

I don't know the dataset in question, but you should see if it comes with a template/mapping as well as the data dump itself.

I am using their wikivoyage dump enwikivoyage-20180625-cirrussearch-content.json.gz from here

They do have an api to retrieve the settings and mappings
https://en.wikivoyage.org/w/api.php?action=cirrus-mapping-dump&format=json&formatversion=2 but it seem to be of 2.x format. The version of the dump as far as i can tell is 5.5.2. I have posted a question on their forum but haven't heard anything back. Trying to use the 2.x mappings gives me a bazillion errors. So I am plodding my way through it trying to figure out which objects map to 5.5.2.

Ahh yeah, looks like they have multiple types there, which won't work with 6.X anyway :frowning:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.