# Problem with parameters of the search() function ES-5.3.0

**URL:** <https://discuss.elastic.co/t/problem-with-parameters-of-the-search-function-es-5-3-0/82285>\
**Category:** Elasticsearch\
**Created:** [April 13, 2017, 12:21pm UTC](https://discuss.elastic.co/t/problem-with-parameters-of-the-search-function-es-5-3-0/82285 "2017-04-13T12:21:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaoulaari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khaoulaari/32/24288_2.png) [@khaoulaari](https://discuss.elastic.co/u/khaoulaari)\
**Post date:** [April 13, 2017, 12:21pm UTC](https://discuss.elastic.co/t/problem-with-parameters-of-the-search-function-es-5-3-0/82285/1 "2017-04-13T12:21:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [April 21, 2017, 7:34am UTC](https://discuss.elastic.co/t/problem-with-parameters-of-the-search-function-es-5-3-0/82285/2 "2017-04-21T07:34:23Z")

</div>

try to use this instead:

```auto
        r = es.search(index, doc_type, body,stored_fields=['_id','_timestamp'], size=10000)

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 19, 2017, 7:36am UTC](https://discuss.elastic.co/t/problem-with-parameters-of-the-search-function-es-5-3-0/82285/3 "2017-05-19T07:36:17Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
