I want to fetch all the data of the corresponding particular field, and have a response of the elastic search.

```
{
"took": 2,
"timed_out": false,
"_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
},
"hits": {
    "total": {
        "value": 35,
        "relation": "eq"
    },
    "max_score": 0.44183275,
    "hits": [
        {
            "_index": "allevents",
            "_type": "_doc",
            "_id": "jQPDaG0BcOh3oggcguoV",
            "_score": 0.44183275,
            "_source": {
                "category": "sessions",
                 "contentid": "KqRLj2lWZ3",
                "clientname": "omkarpathlab",
------------------
}]

```

I tried **search function** it returning an error.

```
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
    host: 'aaa',
    log: 'trace',
    apiVersion: '7.1'
});

client.search({
    "size": 20,
    "query": {
        "query_string": {
        "default_field": "clientname",
        "query": "omkarlab"
        }
    }
     }).then((res) => {
        console.log("resultData", res);
    }, (err) => {
        console.log("err", err);
    });
enter code here

```

Error showing:

> 
> { Error: [illegal\_argument\_exception] request [/\_search] contains unrecognized parameter: [query]
> 
> 
> 

Please suggest me how to solve this kind of problem.