我拼命地尝试在elasticsearch上执行一个简单的搜索操作,但是几个小时后就失败了。这是我的代码:
res = es.search(index="people", doc_type="test", body={"query":{"match":{"name": "john"}}})
我在互联网上看到过很多次,但我总是收到一个错误,并且不知道我的代码片段有什么问题。
Traceback (most recent call last):
File "./es_request.py", line 14, in <module>
res = es.search(index="people", doc_type="test", body={"query":{"match":{"name": "john"}}})
File "/usr/local/lib/python3.4/dist-packages/pyelasticsearch/client.py", line 93, in decorate
return func(*args, query_params=query_params, **kwargs)
TypeError: search() missing 1 required positional argument: 'query'
我必须在哪里编写所需的“查询”?我正在尝试搜索姓名和姓氏。