# No hits field at all in search results

**URL:** <https://discuss.elastic.co/t/no-hits-field-at-all-in-search-results/357870>\
**Category:** Elasticsearch\
**Tags:** docker, language-clients\
**Created:** [April 21, 2024, 7:02pm UTC](https://discuss.elastic.co/t/no-hits-field-at-all-in-search-results/357870 "2024-04-21T19:02:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NICK\_NASIROV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_nasirov/32/133705_2.png) [@NICK\_NASIROV](https://discuss.elastic.co/u/NICK_NASIROV)\
**Post date:** [April 21, 2024, 7:02pm UTC](https://discuss.elastic.co/t/no-hits-field-at-all-in-search-results/357870/1 "2024-04-21T19:02:13Z")

</div>

I have products index, and when I run a query in Dev Tools like so I see results:

```auto
GET /products/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "merchant.id": "1"
          }
        }
      ]
    }
  }
}

```

Result:

```auto
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 0.2876821,
    "hits": [
      {
        "_index": "products",
        "_id": "1",
        "_score": 0.2876821,
        "_source": {
          "id": 1,
          "status": "available",
          "category": {
            "id": 1,
            "name": {
              "en": "Pizza",
              "ru": "Пицца",
              "uz": "Pitsa"
            }
          }...

```

But when I run it with my nodejs app I see results with no `hits` field at all:

```auto
const result = await esClient.search({
      index: "products",
      type: '_doc',
      body: {
        query: {
          match_all: {
            "merchant.id": merchantId
          }
        }
      }
    });

```

and the results here is:

```auto
{
  "body": {
    "_index": "products",
    "_id": "_search",
    "_version": 3,
    "result": "updated",
    "_shards": {
      "total": 2,
      "successful": 1,
      "failed": 0
    },
    "_seq_no": 3,
    "_primary_term": 1
  },
  "statusCode": 200,
  "headers": {
    "content-length": "147",
    "content-type": "application/json",
    "x-cloud-request-id": "ko0mcfl9R3yhhD8MlXj2jA",
    "x-elastic-product": "Elasticsearch",
    "x-found-handling-cluster": "85e169669237424cbe3a332acb8082b6",
    "x-found-handling-instance": "instance-0000000000",
    "date": "Sun, 21 Apr 2024 19:00:16 GMT"
  },
  "meta": {
    "context": null,
    "request": {
      "params": {
        "method": "POST",
        "path": "/products/_doc/_search",
        "body": "{\"query\":{\"match_all\":{\"merchant.id\":\"1\"}}}",
        "querystring": "",
        "headers": {
          "user-agent": "elasticsearch-js/7.17.13 (darwin 23.3.0-arm64; Node.js v21.6.1)",
          "x-elastic-client-meta": "es=7.17.13,js=21.6.1,t=7.17.13,hc=21.6.1",
          "content-type": "application/json",
          "content-length": "43"
        },
        "timeout": 30000
      },
      "options": {},
      "id": 4
    },
    "name": "elasticsearch-js",
    "connection": {
      "url": "https://secret.us-east-2.aws.elastic-cloud.com/",
      "id": "https://secret.us-east-2.aws.elastic-cloud.com/",
      "headers": {},
      "deadCount": 0,
      "resurrectTimeout": 0,
      "_openRequests": 0,
      "status": "alive",
      "roles": {
        "master": true,
        "data": true,
        "ingest": true,
        "ml": false
      }
    },
    "attempts": 0,
    "aborted": false
  }
}

```

where on earth is `hits`??? when i run this agains docker container on my local i see the results.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 21, 2024, 9:27pm UTC](https://discuss.elastic.co/t/no-hits-field-at-all-in-search-results/357870/2 "2024-04-21T21:27:18Z")

</div>

Welcome!

You wrote match\_all in the second query but match in the first.  
But I'm not sure it's the problem here.

Elasticsearch seems to see your request not as a search request but a put document request.  
I don't why as I don't see the full code but that might give you a clue.

---

<div class="post-metadata">

**Author:** ![NICK\_NASIROV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_nasirov/32/133705_2.png) [@NICK\_NASIROV](https://discuss.elastic.co/u/NICK_NASIROV)\
**Post date:** [April 21, 2024, 9:41pm UTC](https://discuss.elastic.co/t/no-hits-field-at-all-in-search-results/357870/3 "2024-04-21T21:41:38Z")

</div>

Thanks for looking at this issue, I found a solution, on my local, I have been using es v7, but I got v8 on staging, sdk on nodejs was v7 too, so I migrated my local es to v8 and updated nodejs library to v8.
