ElasticSearch。如何将数组传递给搜索模板

时间:2019-03-06 09:44:48

标签: python json elasticsearch mustache elasticsearch-template

我有一个搜索系统,需要在其中按位置评分。用户发送他的坐标,我检查它们是否与预索引的多边形相交。问题是我不知道如何将坐标传递到json文件。我使用的是称为Elasticsearch的python库。
下面是如何将搜索数据传递到搜索模板的示例Here is sample of how I pass search data to search template

这就是我试图在搜索模板文件中使用它的方式 enter image description here

但是问题是它被解析为字符串,但是我需要一个浮点数数组。

1 个答案:

答案 0 :(得分:0)

对于坐标,请使用以下格式:“坐标”:[[-77.03653,38.897676],[-77.009051,38.889939]] https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html

有关分数,请加入我们的示例和您的期望,但很确定您将必须使用https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html