Should have hits, got nothing

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 :

"_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 :

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 :

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

my quantity mapping :

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

Can't reproduce it:

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:

{
  "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"
        }
      }
    ]
  }
}

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