I’ve problem with the function search more precisely with the parameter fields
so I’m trying to run the following code and getting the error below
code :
if ElasticSearchMonitor.jobs is None:
es = elasticsearch
start = self.timestamp.replace(minutes=-lookback_minutes)
stop = self.timestamp
body = '''
{
"query": {
"bool": {
"must": [
{ "range": { "_timestamp": { "gte": %(start)s, "lte": %(stop)s }}}
]
}
}
}''' % {'start': start.timestamp*1000, 'stop':stop.timestamp*1000}
r = es.search(index, doc_type, body,fields=['_id','_timestamp'], size=10000)
def gather(memo, value):
memo[value['_id']] = value['fields']
return memo
ElasticSearchMonitor.jobs = reduce(gather, r['hits']['hits'], {})
error :
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, {u'root_cause': [{u'reason': u'The parameter [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored', u'type': u'illegal_argument_exception'}], u'type': u'illegal_argument_exception', u'reason': u'The parameter [fields] is no longer supported, please use [stored_fields] to retrieve stored fields or _source filtering if the field is not stored'})
i've tried to change fields by stored-fields but it doesn’t work
any help plz ?
ps : i'm using elasticsearch 5.3.0