# Should have hits, got nothing

**URL:** <https://discuss.elastic.co/t/should-have-hits-got-nothing/109236>\
**Category:** Elasticsearch\
**Created:** [November 27, 2017, 2:40pm UTC](https://discuss.elastic.co/t/should-have-hits-got-nothing/109236 "2017-11-27T14:40:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylvain\_Attoumani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_attoumani/32/45401_2.png) [@Sylvain\_Attoumani](https://discuss.elastic.co/u/Sylvain_Attoumani)\
**Post date:** [November 27, 2017, 2:40pm UTC](https://discuss.elastic.co/t/should-have-hits-got-nothing/109236/1 "2017-11-27T14:40:23Z")

</div>

Hello everyone, I'm working with elasticsearch in php. I have indexed 'ps\_product' and when I'm going in `localhost:9200/sky/ps_product/39` I have the following result :

```auto
"_index": "sky",
"_type": "ps_product",
"_id": "39",
"_version": 1,
"found": true,
"_source": {
     "id_product": "39",
     "id_supplier": "3",
     "id_manufacturer": "3",
     "id_category_default": "47",
     "id_shop_default": "1",
     "on_sale": "0",
     "online_only": "0",
     "ean13": "3700498930717",
     "upc": "",
     "ecotax": "0.000000",
     "quantity": "1818",
     "minimal_quantity": "1",
     "price": "2.458333",
     [etc...]

```

Wich is nice, but when I'm doign my research I have something like that :

```auto
Array
(
    [took] => 3
    [timed_out] => 
    [_shards] => Array
        (
            [total] => 5
            [successful] => 5
            [skipped] => 0
            [failed] => 0
        )

    [hits] => Array
        (
            [total] => 0
            [max_score] => 
            [hits] => Array
                (
                )

        )

)

```

So I should have something in my `hits` but nothing. My search looks like that :

```auto
$params3 = [
    'index'=>'sky',
    'type' => 'ps_product',
    'body' => [
        'query' => [
            'match'=> [
                'quantity' => 1818'
            ]
        ]
    ]
];
$response = $client->search($params3);
print_r($response);

```

my quantity mapping :

```auto
"quantity": {
    "type": "text",
    "fields": {
        "keyword": {
            "type": "keyword",
            "ignore_above": 256
        }
    }
},

```

---

<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:** [November 27, 2017, 8:25pm UTC](https://discuss.elastic.co/t/should-have-hits-got-nothing/109236/2 "2017-11-27T20:25:41Z")

</div>

Can't reproduce it:

```auto
DELETE test
PUT test/doc/1
{
    "id_product": "39",
    "id_supplier": "3",
    "id_manufacturer": "3",
    "id_category_default": "47",
    "id_shop_default": "1",
    "on_sale": "0",
    "online_only": "0",
    "ean13": "3700498930717",
    "upc": "",
    "ecotax": "0.000000",
    "quantity": "1818",
    "minimal_quantity": "1",
    "price": "2.458333"
}
GET test/_search
{
  "query": {
    "match": {
      "quantity": "1818"
    }
  }
}

```

Gives:

```auto
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.2876821,
    "hits": [
      {
        "_index": "test",
        "_type": "doc",
        "_id": "1",
        "_score": 0.2876821,
        "_source": {
          "id_product": "39",
          "id_supplier": "3",
          "id_manufacturer": "3",
          "id_category_default": "47",
          "id_shop_default": "1",
          "on_sale": "0",
          "online_only": "0",
          "ean13": "3700498930717",
          "upc": "",
          "ecotax": "0.000000",
          "quantity": "1818",
          "minimal_quantity": "1",
          "price": "2.458333"
        }
      }
    ]
  }
}

```

---

<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:** [December 25, 2017, 8:26pm UTC](https://discuss.elastic.co/t/should-have-hits-got-nothing/109236/3 "2017-12-25T20:26:17Z")

</div>

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