ElasticSearch. How to pass array to the search template

China☆狼群 提交于 2019-12-25 03:02:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!