嗨,我想用弹性搜索.py“api。但我甚至没有得到任何结果。在
API文档似乎有3到4个与渗滤相关的函数。在
我检查了以下可能性。有谁能帮忙,这样我就能解决这个问题。在
es = Elasticsearch()
query = {'query': {'term': {'message': 'bonsai tree'}}}
es.create(index='test', doc_type='message', percolate=query, id='kuku2', body = {"message":"bonsai tree"})
doc = {'doc': {'message': 'I am a bonsai tree'}}
k = es.percolate(index='test', doc_type='type1', body=doc)
print k
结果
^{pr2}$我希望”渗滤液“用于搜索。”es.创建“允许我们将文档注册为percolate索引。但在文件中并没有如此完美地提及。“渗滤液”也被用来代替索引。请帮忙。在
术语查询不会标记或分析搜索文本。因此,给出一个短语there将进行术语查询以查找令牌的精确匹配。没有存在。所以如果使用匹配查询,它应该可以工作
我修改了@Roy2012的答案,以便与es5.1一起使用
这是我的代码:
唯一的区别是如何创建索引和注册查询。在
下面这段文字对我有用(在es1.4.4上)。关键点似乎是在
es.create
中使用doc_type='.percolator'
。在相关问题 更多 >
编程相关推荐