elasticsuite: Prices are not being indexed and sorting by price is not working

Hi,

I have a problem where sorting products inside category by price is not working at all. I have dig a little and can see that prices are not being indexed in elasticsearch which I think is related because as far as I digged into the code sorting is done inside the query to elasticsearch.

Here is what I get when I request: http://localhost:9200/magento2_default_migrated_catalog_product_20190221_070838/product/_search?pretty&q=entity_id:101722

{
  "took" : 8,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "magento2_default_migrated_catalog_product_20190221_070838",
        "_type" : "product",
        "_id" : "101722",
        "_score" : 1.0,
        "_source" : {
          "entity_id" : "101722",
          "attribute_set_id" : "9",
          "type_id" : "configurable",
          "sku" : [
            "TestS30",
            "TestS30-one size"
          ],
          "has_options" : false,
          "required_options" : false,
          "created_at" : "2016-10-21 10:37:28",
          "updated_at" : "2018-11-20 06:39:06",
          "search_weight" : "0",
          "visibility" : "4",
          "category" : [
            {
              "category_id" : 3,
              "is_virtual" : "false"
            },
            {
              "category_id" : 8,
              "is_parent" : true,
              "is_virtual" : "false"
            },
            {
              "category_id" : 12,
              "is_parent" : true,
              "is_virtual" : "false",
              "name" : "Brands"
            },
            {
              "category_id" : 256,
              "is_parent" : true,
              "is_virtual" : "false",
              "name" : "Test "
            }
          ],
          "name" : [
            "Testing123"
          ],
          "indexed_attributes" : [
            "name",
            "image",
            "description",
            "status",
            "tax_class_id",
            "news_from_date"
          ],
          "image" : [
            "/m/e/metting123.jpg"
          ],
          "description" : [
            "testing123"
          ],
          "status" : [
            1
          ],
          "option_text_status" : [
            "Enabled"
          ],
          "tax_class_id" : [
            2
          ],
          "option_text_tax_class_id" : [
            "Taxable Goods"
          ],
          "news_from_date" : [
            "2017-01-01 00:00:00"
          ],
          "children_ids" : [
            101723
          ],
          "children_attributes" : [
            "indexed_attributes"
          ],
          "configurable_attributes" : [
            null
          ],
          "stock" : {
            "is_in_stock" : true,
            "qty" : 0
          }
        }
      }
    ]
  }
}

As you can see there is no price indexed at all. I have dig into the code and found out that the prices are retrieved based on the “catalog_product_index_price” table from database, but in my case this table is empty and I’m not sure why or when this table is being populated.

I spotted that I have a “catalog_product_index_price_idx” table filled with ~160k records which is exactly the same in terms of structure and if I change the code from “catalog_product_index_price” to: “catalog_product_index_price_idx” and run re-indexing, prices will show up in the index but sorting by price is still not working. I have even tried changing theme to luma which didn’t help either.

My store contains thousands of configurable and simple products which I’m not sure if might be related to this issue.

Magento Version : 2.2.6 CE

ElasticSuite Version : 2.6.4, 2.6.6

Environment : developer & production

Third party modules : I have tried disabling all related modules and it didn’t help.

Any idea why my “catalog_product_index_price” table might be empty?

I’m really thankful for this module and would appreciate any help here.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22

Commits related to this issue

Most upvoted comments

@rbayet Just wanted to confirm that changing the dimensions mode to none fixes sorting issue without any changes in any module.

From what you’re telling me, and according to \Magento\Catalog\Model\Indexer\Product\Price\DimensionModeConfiguration you should find this somewhere

        <indexer>
            <catalog_product_price>
                <dimensions_mode>website</dimensions_mode>
            </catalog_product_price>
        </indexer>

If that’s not the case, I’ll have to dig deeper into the “mode switcher” and its usage. It may be an admin exposed related setting which changes the value directly into the config cache.

Actually, running php bin/magento indexer:show-dimensions-mode should give you

Product Price:                                     website

Could you confirm @Mathiu ?

If so, it means you could probably dispense of the DI introduced plugins with a simple php bin/magento indexer:set-dimensions-mode catalog_product_price none

Long story short you may have pinpointed a blank spot of the module which would not be 100% due to the migration.

Indeed :

Regards,

@abbatis You might try out #1326, run bin/magento setup:upgrade and then bin/magento indexer:reindex and check if its fixes the issue for you as well.