0

I'm trying to deploy my app and index a model. Everything is working fine until i'm trying to actually get the data from elasticsearch. My environment is staging but when i perform a search via a rest api i get an error

{
  "status": "error",
  "messages": 
  "[404]{\"error\":\"IndexMissingException[[myapp_production_products] missing]\",\"status\":404}"
}

From this:

[myapp_production_products]

i deduced that it's trying to query elasticsearch on wrong environment. What is causing this?

Michael Kosyk
  • 348
  • 1
  • 2
  • 10

2 Answers2

1

Have you indexed the product? May be it will solve the issue.

Thanks!

Santanu
  • 960
  • 10
  • 14
  • The index was not actually created which is odd. Product.import created the index locally, but on the server - no. I had to create it on my own by Product.create_index. Product is my model. – Michael Kosyk Jul 08 '15 at 13:35
  • 1
    Yes rake task is fine. You can do it in a callback ```after_commit```. vote my ans plz. – Santanu Jul 09 '15 at 12:32
0

Ok, so the problem was not with bad index naming. The index was not created at all, which is super weird (i made the same thing on my local machine and it was working, the index was created).

I just added a rake task for creating the index.

Michael Kosyk
  • 348
  • 1
  • 2
  • 10