Using magento2-vsbridge-indexer instead of mage2vs

I’m tring to use magento2-vsbridge-indexer instead of the mage2vs, but after fresh installation this error occured.

[search] Can not connect the vue-storefront-api / ElasticSearch instance! Error: {"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [stock.product_id] in order to sort on",

So, I looked into stock.product_id in elasticsearch by http://esdomain:9200/index/product/_search.
magento2-vsbridge-indexer’s:

"stock": {
  "qty": 11.0,
  "is_in_stock": true,
  "stock_status": 1
}

Mage2vs’s stock is like this,

"stock": {
  "item_id": 55,
  "product_id": 52,
  "stock_id": 1,
  "qty": 218,
  "is_in_stock": true,
  "is_qty_decimal": false,
  "show_default_notification_message": false,
  "use_config_min_qty": true,
  "min_qty": 0,
  "use_config_min_sale_qty": 1,
  "min_sale_qty": 1,
  "use_config_max_sale_qty": true,
  "max_sale_qty": 30,
  "use_config_backorders": true,
  "backorders": 0,
  "use_config_notify_stock_qty": true,
  "notify_stock_qty": 1,
  "qty_increments": 0,
  "use_config_enable_qty_inc": true,
  "enable_qty_increments": false,
  "use_config_manage_stock": true,
  "manage_stock": true,
  "low_stock_date": null,
  "is_decimal_divided": false,
  "stock_status_changed_auto": 0
}

Why are these data schemas have so different shape like this?

What should I do to solve this problem?

(If I installed some different version or missing something, so sorry.)

vsf local.json

"elasticsearch": {
      "httpAuth": "",
      "host": "https://m.vitacafe.com/api/catalog",
      "index": "vue_storefront_magento_1",

vsf-api local.json

    "elasticsearch": {
         "host": "localhost",
         "port": 9200,
         "protocol": "http",
         "min_score": 0.01,
         "indices": [
           "vue_storefront_magento_1"
         ],

http://esdomain:9200/_cat/indices

yellow open vue_storefront_magento_1_1578944303 H4pDM3yuT0yUdZ-0dl2kvA 5 1 4146 0 32.1mb 32.1mb

After all, I always did,

npm run db rebuild -- --indexName=vue_storefront_magento
npm run migrate
systemctl restart elasticsearch
yarn rebuild(vsf, vsf-api both)
yarn dev(vsf, vsf-api both)

Thank you.

The error message you pasted is caused because you need to adjust your elasticsearch schema to proper mapping for the stock.product_id field in order to sort on it (not sure why are you sorting on this field?) - you can do this by setting the proper mapping

However as you realized this is not the root cause of the issue.
The root cause is that the stock.product_id is not yet there from magento2-vsbridge-indexer

@afirlejczyk do you have any idea why it can be like that?

I’ve spoken with @afirlejczyk and added feature request for that in some cases this field can be actually missed: https://github.com/DivanteLtd/magento2-vsbridge-indexer/issues/187

However, across the VSF I haven’t seen any place where are we sorting by stock.produc_id. Is that some custom feature?