Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
761 stars 340 forks source link

Error: no mapping found for field [search.whitespace] #3306

Closed Playhf closed 2 months ago

Playhf commented 3 months ago

Hello we're having an issue after reindex and trying to load category page: Exception #0 (OpenSearch\Common\Exceptions\BadRequest400Exception): {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_idegaarden_catalog_product_20240626_081350","node":"P_6BnSxbQVeVPqVHIMnQdA","reason":{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]"}}],"caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]","caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]"}}},"status":400}

Magento Version : 2.4.7 ElasticSuite Version :2.11.7. Along with hyva-themes/magento2-smile-elasticsuite:1.2.4.

Steps to reproduce

  1. Install hyva-themes/magento2-smile-elasticsuite:1.2.4
  2. php bin/magneto indexer:reindex
  3. Go to category page.

Expected result

  1. Plp loads without any errors.

Actual result

  1. Error message in developer mode. Screenshot 2024-06-26 at 11 35 33
  2. Error log in production mode `[2024-06-26T07:45:23.510017+00:00] main.CRITICAL: OpenSearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_idegaarden_catalog_product_20240626_073206","node":"ZE04yHunSeieHGsMMVAP9A","reason":{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]"}}],"caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]","caused_by":{"type":"illegal_argument_exception","reason":"no mapping found for field [search.whitespace]"}}},"status":400} in /home/id-dev/releases/20240626-092820/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php:664 Stack trace:

    0 /home/id-dev/releases/20240626-092820/vendor/opensearch-project/opensearch-php/src/OpenSearch/Connections/Connection.php(328): OpenSearch\Connections\Connection->process4xxError()

    1 /home/id-dev/releases/20240626-092820/vendor/react/promise/src/FulfilledPromise.php(28): OpenSearch\Connections\Connection->OpenSearch\Connections{closure}()

    `

Technical information

In the search request object \Smile\ElasticsuiteCore\Search\Request\Query\Filtered in query property i can see*Smile\ElasticsuiteCore\Search\Request\Query\MultiMatch*fields array with following fields:

  1. search.whitespace
  2. name.whitespace
  3. sku.whitespace

In admin panel i found a mapping for both name and sku and i can see whitespace is defined there. The same can't be said about search.whitespace.

Screenshot 2024-06-26 at 11 40 18

Please assist me with this issue. Thanks

Playhf commented 3 months ago

@vahonc could you please participate?

Playhf commented 3 months ago

@romainruaud if you have any experience with such in issues as well I would really appreciate your help.

rbayet commented 3 months ago

Hello @Playhf,

Could you copy/paste either your full mapping or at least the section relative to the "search" (multi) field ?

Regards,

Playhf commented 3 months ago

Hello @rbayet yes, here is the mapping for catalog product index. catalog_product_index_map.txt

romainruaud commented 3 months ago

Any chance you might be having an attribute named "search" ?

rbayet commented 3 months ago

Any chance you might be having an attribute named "search" ?

Yes, looking at the mapping, I can see that

  "search": {
    "type": "text",
    "fields": {
      "standard": {
        "type": "text",
        "analyzer": "standard"
      }
    },
    "copy_to": [
      "search",
      "spelling"
    ],
    "norms": false,
    "analyzer": "keyword"
  }

That's typical of a searchable text attribute whose attribute code is indeed "search" and our magic "search" is not present, whose mapping should be

  "search": {
    "type": "text",
    "fields": {
      "shingle": {
        "type": "text",
        "analyzer": "shingle"
      },
      "whitespace": {
        "type": "text",
        "analyzer": "whitespace"
      }
    },
    "analyzer": "standard"
  }
github-actions[bot] commented 2 months ago

This issue was waiting update from the author for too long. Without any update, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.