[英]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.
问题是我不知道如何将坐标传递到json文件。 I use python library called elasticsearch.
我使用名为elasticsearch的python库。
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 对于坐标,请使用以下格式:“坐标”:[[-77.03653,38.897676],[-77.009051,38.889939]] https://www.elastic.co/guide/zh/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://www.elastic.co/guide/zh-CN/elasticsearch/reference/current/query-dsl-function-score-query html的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.