1

We encounter an issue on Magento 2.4.0. Products don't show up in the frontend in the categories. The product is visible on its own url key though.

I connected to Elastic Search to check the contents of an index. When I open one. For example magento2staging_product_1_v3. Then I see the follow error.

Can someone explain what the actual problem is. And how I can solve it?

{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "failed to create query: {\n \"query_string\" : {\n \"query\" : \"*\",\n \"fields\" : [ ],\n \"type\" : \"best_fields\",\n \"default_operator\" : \"or\",\n \"max_determinized_states\" : 10000,\n \"enable_position_increments\" : true,\n \"fuzziness\" : \"AUTO\",\n \"fuzzy_prefix_length\" : 0,\n \"fuzzy_max_expansions\" : 50,\n \"phrase_slop\" : 0,\n \"escape\" : false,\n \"auto_generate_synonyms_phrase_query\" : true,\n \"fuzzy_transpositions\" : true,\n \"boost\" : 1.0\n }\n}",
        "index_uuid": "Pn2mKvC6SmyBk74DMlZLYA",
        "index": "magento2staging_product_1_v2"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "magento2staging_product_1_v2",
        "node": "7RRbIf6URV2u9is_iAejTA",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: {\n \"query_string\" : {\n \"query\" : \"*\",\n \"fields\" : [ ],\n \"type\" : \"best_fields\",\n \"default_operator\" : \"or\",\n \"max_determinized_states\" : 10000,\n \"enable_position_increments\" : true,\n \"fuzziness\" : \"AUTO\",\n \"fuzzy_prefix_length\" : 0,\n \"fuzzy_max_expansions\" : 50,\n \"phrase_slop\" : 0,\n \"escape\" : false,\n \"auto_generate_synonyms_phrase_query\" : true,\n \"fuzzy_transpositions\" : true,\n \"boost\" : 1.0\n }\n}",
          "index_uuid": "Pn2mKvC6SmyBk74DMlZLYA",
          "index": "magento2staging_product_1_v2",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "field expansion matches too many fields, limit: 4096, got: 37067"
          }
        }
      }
    ]
  },
  "status": 400
}

EDIT: I added a part from /var/log/elasticsearch/elasticsearch.log below.

[2022-06-24T12:30:02,688][DEBUG][o.e.a.s.TransportSearchAction] [<hostname>] [magento2__product_15_v25][0], node[7RRbIf6URV2u9is_iAejTA], [P], s[STARTED], a[id=r2GeTSf4RVuRxvGZfkoqEQ]: Failed to execute [SearchRequest{searchType=QUERY_THEN_FETCH, indices=[magento2__product_15_v25], indicesOptions=IndicesOptions[ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=128, allowPartialSearchResults=true, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1, ccsMinimizeRoundtrips=true, source={"from":0,"size":10,"query":{"query_string":{"query":"*","fields":[],"type":"best_fields","default_operator":"or","max_determinized_states":10000,"enable_position_increments":true,"fuzziness":"AUTO","fuzzy_prefix_length":0,"fuzzy_max_expansions":50,"phrase_slop":0,"escape":false,"auto_generate_synonyms_phrase_query":true,"fuzzy_transpositions":true,"boost":1.0}},"sort":[]}}]
org.elasticsearch.transport.RemoteTransportException: [<hostname>][127.0.0.1:9300][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.index.query.QueryShardException: failed to create query: {
  "query_string" : {
    "query" : "*",
    "fields" : [ ],
    "type" : "best_fields",
    "default_operator" : "or",
    "max_determinized_states" : 10000,
    "enable_position_increments" : true,
    "fuzziness" : "AUTO",
    "fuzzy_prefix_length" : 0,
    "fuzzy_max_expansions" : 50,
    "phrase_slop" : 0,
    "escape" : false,
    "auto_generate_synonyms_phrase_query" : true,
    "fuzzy_transpositions" : true,
    "boost" : 1.0
  }
}
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:350) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:333) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.parseSource(SearchService.java:750) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.createContext(SearchService.java:591) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:550) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:351) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$1(SearchService.java:343) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionListener.lambda$map$2(ActionListener.java:146) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:58) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:73) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:692) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.6.0.jar:7.6.0]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
  at java.lang.Thread.run(Thread.java:830) [?:?]
Caused by: java.lang.IllegalArgumentException: field expansion matches too many fields, limit: 4096, got: 37778
  at org.elasticsearch.index.search.QueryParserHelper.checkForTooManyFields(QueryParserHelper.java:182) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.search.QueryParserHelper.resolveMappingField(QueryParserHelper.java:175) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.search.QueryParserHelper.resolveMappingField(QueryParserHelper.java:116) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.search.QueryStringQueryParser.<init>(QueryStringQueryParser.java:140) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryStringQueryBuilder.doToQuery(QueryStringQueryBuilder.java:863) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:99) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:334) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:346) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:333) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.parseSource(SearchService.java:750) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.createContext(SearchService.java:591) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:550) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:351) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$1(SearchService.java:343) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionListener.lambda$map$2(ActionListener.java:146) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:58) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:73) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:692) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-7.6.0.jar:7.6.0]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
  at java.lang.Thread.run(Thread.java:830) ~[?:?]
  
  [2022-06-24T12:30:02,690][DEBUG][o.e.a.s.TransportSearchAction] [<hostname>] All shards failed for phase: [query]
org.elasticsearch.index.query.QueryShardException: failed to create query: {
  "query_string" : {
    "query" : "*",
    "fields" : [ ],
    "type" : "best_fields",
    "default_operator" : "or",
    "max_determinized_states" : 10000,
    "enable_position_increments" : true,
    "fuzziness" : "AUTO",
    "fuzzy_prefix_length" : 0,
    "fuzzy_max_expansions" : 50,
    "phrase_slop" : 0,
    "escape" : false,
    "auto_generate_synonyms_phrase_query" : true,
    "fuzzy_transpositions" : true,
    "boost" : 1.0
  }
}
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:350) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:333) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.parseSource(SearchService.java:750) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.createContext(SearchService.java:591) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:550) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:351) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$1(SearchService.java:343) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionListener.lambda$map$2(ActionListener.java:146) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:63) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:58) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:73) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:44) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:692) [elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.6.0.jar:7.6.0]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
  at java.lang.Thread.run(Thread.java:830) [?:?]
Caused by: java.lang.IllegalArgumentException: field expansion matches too many fields, limit: 4096, got: 37778
  at org.elasticsearch.index.search.QueryParserHelper.checkForTooManyFields(QueryParserHelper.java:182) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.search.QueryParserHelper.resolveMappingField(QueryParserHelper.java:175) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.search.QueryParserHelper.resolveMappingField(QueryParserHelper.java:116) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.search.QueryStringQueryParser.<init>(QueryStringQueryParser.java:140) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryStringQueryBuilder.doToQuery(QueryStringQueryBuilder.java:863) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:99) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:334) ~[elasticsearch-7.6.0.jar:7.6.0]
  at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:346) ~[elasticsearch-7.6.0.jar:7.6.0]
  ... 17 more
4
  • 1
    can you please check /var/log/elasticsearch.log and add the logs here
    – Waqar Ali
    Jun 24 at 10:35
  • @WaqarAli I added the logs. Thanks for the suggestion.
    – Akif
    Jun 24 at 20:20
  • Use the appropriate ElasticSearch version compatible with Magento 2.4.0 devdocs.magento.com/guides/v2.4/install-gde/… It's a must do Jun 28 at 12:29
  • @DanielIfrim thx. We are running version 7.6.0 That is actually the explicit requirement for 2.4.0.
    – Akif
    Jun 28 at 12:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.