I am new to Elasticsearch and am currently working on implementing a geo_distance
filter for searching. As of now my index has the following mapping (I've removed some fields):
{
advert_index: {
mappings: {
advert_type: {
properties: {
__v: {
type: "long"
},
caption: {
type: "string"
},
category: {
type: "string"
},
**location: {
type: "long"
},**
}
}
}
}
The geo_distance field is going to be implemented on the location field, where an example instance looks like this:
"location": [
71,
60
],
I.e. is on geoJSON format [lon, lat]
.
I understand that I will have to update my index so that the location field is of type geo_point
, as described in the documentation (mapping-geo-point). It seems like I have to drop the index and create a new one, but I am not able to do this.
Am I on the right track? I would greatly appreciate it if anyone could help me with how I could create a new index or update my existing one with the correct data type.
Many thanks!