Closed siddharthlatest closed 7 years ago
Hey guys, I need some input with this issue.
I am getting query_parsing_exception
- "failed to find geo_point field [pin.location]" when I try to run the query. I am able to generate the query of the format:
{
"query": {
"bool": {
"filter": [
{
"geo_distance": {
"distance": "200km",
"pin.location": {
"lat": "40",
"lon": "-70"
}
}
}
]
}
}
}
I had to list geo_distance
under string
in queryList (to check whether I'm able to generate the query of the desired format), since ES is not able to detect the Geo Point
type.
Can you suggest a solution to this?
What is the datatype of location field? it should be geo_point
, otherwise geo query will fail.
Yeah about that, do you mean:
Specifying @Input() selectedField: geo_point;
in the component and adding mappings in ES?
No no I am not asking about typescript datatype. I am asking about es mapping datatype.
Pin.location should have geo_point datatype of es mapping.
You should add Geo_point: ['geo_distance'] in ananlyzed, non_analyzed of queryList.
Where geo_point is datatype and geo_distance is query name.
Yes, I've already done that, but it seems ES is not able to determine the type of the field. It is undefined
.
Then you need to pick a new field and add geo_point mapping for that.
I've tried that, but I think I am missing something. Type of the field is still undefined.
How should I add the geo_point mapping for this field (pin)?
@metagrover ES field type needs to be defined (via mappings), Elasticsearch can't auto-infer it as geo-point. Since mappings are also immutable starting v2.0, you should define it for a new field. https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html
Implement support for Geo Distance Query.
Prerequisites
Code Structure
The code structure will resemble the files in this path - https://github.com/appbaseio/mirage/tree/dev/app/build/singlequery/queries.
There should be two files created:
geodistance.query.ts
andgeodistance.query.spec.ts
.Before PR