问题
I have a search system in which i need to score by location. User sends his coordinates, I check whether they intersect with pre-indexed polygons. The problem is I don't know how to pass coordinates to json file. I use python library called elasticsearch.
Here is sample of how I pass search data to search template
And this is how I'm trying to use it in search template file
But the problem is it gets parsed as a string, but I need an array of floats.
回答1:
For coordinates,use this format : "coordinates" : [[-77.03653, 38.897676], [-77.009051, 38.889939]] https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html
For the score please join us exemple and what you expect, but pretty sure you will have to use a https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html
来源:https://stackoverflow.com/questions/55019939/elasticsearch-how-to-pass-array-to-the-search-template