简体   繁体   中英

ElasticSearch. How to pass array to the search template

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM