Hello, I am using ES js wrapper in a nodejs application. I would like to
get ES to do some geospatial searches, so from what I understand, I need to
set the following options on mylocation field:
mylocation: {
properties: {
type: 'geo_point',
lat_lon: true
}
}
I am inserting the data like so:
// In my nodejs insert()
client.index({
index: 'myapp',
type: 'user',
id: user.id,
body: {
name: user.name,
mylocation: { lat: mylat, lon: mylon}
}
});
This inserts the lat,lon as doubles though. To counter this, I have a
declared a mapping:
client.indicies.putMappings({
index: 'myapp',
type: 'user',
body: {
'user': {
properties: {
mylocation: { type: 'geo_point', lat_lon: true }
}
}
}
});
This all works, but it is it possible to supply ES a certain format so that
ES will automatically create a geo_point type with lat_lon set to true?
If not, could someone clarify where I should declare the mappings? Should
mappings be declared each time before an insert/update happens in ES or is
it just one time? If it's just one time, do I put the mapping inside my
root nodejs application? What happens if I restart the nodejs application:
would the mapping attempt to go through all ES documents and reindex the
mylocation field to geo_point even though it's already been set from the
previous reboot of the app?
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d1ac1327-365f-4bcb-a0f9-94dd89580c7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.