Skip to content

Can’t create product with stock

I’m trying to create a product with stock (quantity), so I can do an example purchase. But whenever I try to create a product, I get the following error: “The stock item was unable to be saved. Please try again.” (first picture). I got a little deeper, went to the logs and found out the following error when trying to create a product:

[2023-12-13T19:31:30.664971+00:00] main.ERROR: {"error":"no handler found for uri [/magento2_product_1_v1/document/_bulk] and method [POST]"} [] []

[2023-12-13T19:31:30.694164+00:00] main.CRITICAL: Exception message: The stock item was unable to be saved. Please try again.

I also went to the Index Managment tab and found out that Catalog Search needs a reindex (second picture), but when I ran bin/magento index:reindex on console I got the following error: {"error":"no handler found for uri [/magento2_product_1_v2/document/_mapping] and method [PUT]"}. I’m guessing that both errors are related or maybe one contains the other, but I’m struggling to find the solution.

I’m using Magento v2.4.6-p1 and Elasticsearch 7.17.4, so I think it is not a compatibility problem as signaled in various posts. I also have my elasticsearch server running (I curl to localhost:9200 and I get a JSON response). I read in the following link that I had to add some configuration to elasticsearch, so I vimmed into /opt/homebrew/etc/elasticsearch/elasticsearch.yml (I’m using Mac M1) and added indices.id_field_data.enabled: true, but it didn’t work.

I ran out of ideas, so any help would be appreciated!

enter image description here
enter image description here