【发布时间】:2017-09-04 12:41:24
【问题描述】:
对整数数组数据类型的查询有多复杂?这是我在 python 中的类,用于将数据注入elasticsearch:
class Paragraph(DocType):
body = Text(analyzer="standard")
published_from = Date()
lines = Integer()
n_paragraph = Integer()
capture = Integer()
class Meta:
index = "my_index"
def save(self, **kwargs):
self.lines = len(self.body.split())
return super(Paragraph, self).save(**kwargs)
我在捕获中注入一个整数数组。这是有趣的一行:
paragraph.capture = [1, 0, 5, 7]
我设法查询一个数字是否在列表中::
cnx = Search().using(client) s = cnx.query("match", capture=5)正如@Val所说,我们可以添加另一个包含sum的字段来查询总和
如何查询特定索引,例如paragraph.capture[1] >= 1?
我们看到 Elasticsearch query on array index 是相关的,但我无法建立链接。
【问题讨论】:
标签: python elasticsearch elasticsearch-dsl