2016-11-25 3 views
3

Le document API indique que search(*args, **kwargs) a un paramètre appelé analyzer. Mais le code suivant soulève une exception:Elasticsearch-py paramètre 'analyseur' non reconnu dans search()

RequestError:TransportError(400, 'illegal_argument_exception', 'request [/test-index/content-field/_search] contains unrecognized parameter: [analyzer]')

from elasticsearch import Elasticsearch 
from elasticsearch.client import IndicesClient 
es = Elasticsearch() 
res = es.search(index="test-index", doc_type='content-field', 
       body={"query": {"match": {"text": "微观文明"}}}, 
       analyzer="ik_smart", size=3) 

Le code suivant, cependant, renvoie une réponse correcte.

i=IndicesClient(es) 
res=i.analyze(index="test-index",body="我你大家",analyzer="ik_smart") 

Répondre