Skip to content

[BUG]Elasticsearch - sorting by price ascending / descending throws error 500 #1960

@digitalwert-devs

Description

@digitalwert-devs

Current Behavior

When Elasticsearch is enabled and you want to sort the listing by price in descending or ascending order, a 500 error is thrown. Elasticsearch logs the following:

[2025-07-04T06:20:52.253626+00:00] elasticsearch.CRITICAL: {"error":{"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [price.c_b7d2554b0ce847cd82f3ac9bd1c0dfca.gross] in order to sort on","index_uuid":"yqMLnLWHROeeDEjLA6fY3w","index":"sw6_product_1751592601"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"sw6_product_1751592601","node":"bOa3juslQW6q98MlfU_f_A","reason":{"type":"query_shard_exception","reason":"No mapping found for [price.c_b7d2554b0ce847cd82f3ac9bd1c0dfca.gross] in order to sort on","index_uuid":"yqMLnLWHROeeDEjLA6fY3w","index":"sw6_product_1751592601"}}]},"status":400} [] []

In the database, variant items do not have a price if they inherit it from the parent product. In my opinion, this causes the error.

Expected Behavior

Sort the products by the price of there parent products.

Steps To Reproduce

  1. setup elastic search
  2. add products with variants that inherit prices of their parents
  3. sort listing by price

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions