thealitahir
(Muhammad Ali Tahir)
January 12, 2018, 6:12am
1
I'm working on node js (version 6.1.0 ) application and using elasticsearch (version 5.0.1) in it. But I'm having issues in geo_point query.
The schema of my elasticsearch after assigning mapping is as follows,
{
"newtesting": {
"aliases": {},
"mappings": {
"newtesting": {
"properties": {
"location": {
"properties": {
"pin": {
"properties": {
"location": {
"type": "geo_shape"
}
}
}
}
}
}
}
},
and when I insert values through this code,
PUT /newtesting/newtesting/1
{
"pin" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
}
}
then my mapping gets changed like this,
{
"newtesting": {
"aliases": {},
"mappings": {
"newtesting": {
"properties": {
"location": {
"properties": {
"pin": {
"properties": {
"location": {
"type": "geo_shape"
}
}
}
}
},
"pin": {
"properties": {
"location": {
"properties": {
"lat": {
"type": "float"
},
"lon": {
"type": "float"
}
}
}
}
}
}
}
},
Due to which my geo_point search query gives this error
"[query_shard_exception] failed to find geo_point field [pin.location]"
Anyone who has some idea about this?
dadoonet
(David Pilato)
January 12, 2018, 6:39am
2
Please don't post images of text as they are hardly readable and not searchable.
Instead paste the text and format it with </>
icon. Check the preview window.
Please update your question.
thealitahir
(Muhammad Ali Tahir)
January 12, 2018, 6:51am
3
Sorry for that, is it okay now?
1 Like
dadoonet
(David Pilato)
January 12, 2018, 7:11am
4
Some comments.
The mapping you created indicates that you are writing (I think) in an index called newtesting
and the document type is newtesting
.
But then you index with PUT /my_locations/location/1
where index name is my_locations
and type is location
.
Are you sure your example is correct?
Could you provide a full recreation script as described in
The heart of the free and open Elastic Stack
Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease.
PLEASE READ THIS SECTION IF IT'S YOUR FIRST POST
Some useful links:
elasticsearch reference guide
elasticsearch user guide
elasticsearch plugins
elasticsearch cl…
It will help to better understand what you are doing.
Please, try to keep the example as simple as possible.
thealitahir
(Muhammad Ali Tahir)
January 12, 2018, 7:18am
5
sorry there was a typing mistake, see my example again
dadoonet
(David Pilato)
January 12, 2018, 7:27am
6
According to your mapping you should write:
PUT /newtesting/newtesting/1
{
"location" : {
"pin" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
}
}
1 Like
thealitahir
(Muhammad Ali Tahir)
January 12, 2018, 10:10am
7
It worked. Thank you so much for the help
system
(system)
Closed
February 9, 2018, 10:10am
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.