0

First of all, let me say i'm sure the code isn't responsible for this, because i have the same branch deployed on two different env, and the error just occurs in the second one. So, this as to be somehow a configuration or database error. But I can't see which one it is.

[2021-02-18 15:21:06] main.CRITICAL: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_2_v5","node":"ZRfeJsBKQwie8_mjHFqdTA","reason":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} {"exception":"[object] (Elasticsearch\Common\Exceptions\BadRequest400Exception(code: 400): {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"magento2_product_2_v5","node":"ZRfeJsBKQwie8_mjHFq","reason":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [origin_pro] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} at /home/preprod/www/releases/20210218145416/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:632)"}

The origin_pro attribute is something existing since a few month

$attributeCode = 'origin_pro';
$eavSetup->addAttribute(
    \Magento\Catalog\Model\Product::ENTITY,
    $attributeCode,
    [
        'user_defined' => true,
        'type' => 'varchar',
        'backend' => '',
        'frontend' => '',
        'label' => 'Origine Pro',
        'input' => 'text',
        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
        'visible' => true,
        'required' => false,
        'default' => false,
        'searchable' => true,
        'filterable' => true,
        'comparable' => false,
        'visible_on_front' => true,
        'used_in_product_listing' => true,
        'unique' => false,
        'apply_to' => ''
    ]
);

As a result this seems to cause my product list to be empty.

2 Answers 2

2

Your origin_pro is a text value and can not be used as filterable that's why you are getting error on elasticsearch. Solution : make that atrribute is_filterable = 0 from atrribute setting.

3
  • Well this is also what I made in the first place, but I wouldn't call it a solution (even if it's the one i'm using temporary), sure it will work but I won't be able to filter the attribute anymore after that. I'm sure there is some way to alterate elastic and being able to use text as filter.
    – Claims
    Feb 23, 2021 at 10:53
  • Understand, if you find a solution please update your post please :) Feb 24, 2021 at 6:05
  • Why don't you think to convert origin_pro attribute to select atrribute instead of text. What is the purpose ? Feb 24, 2021 at 6:07
2

Hello Just try below solution i got same error and it;s works fine with no issue: https://support.magento.com/hc/en-us/articles/360027356612-Elasticsearch-5-is-configured-but-search-page-does-not-load-with-Fielddata-is-disabled-error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.