How do I create elasticsearch indexes for ruby projects?

Viewed 10697

I've gone over this: https://github.com/elasticsearch/elasticsearch-ruby/tree/master/elasticsearch-api#usage

The given example for creating an index is`

client.index  index: 'myindex', type: 'mytype', id: 1, body: { title: 'Test' }

I've looked everywhere and can't seem to find any descriptions of the parameters, ie. index, type, id, body. I'm just not sure what type of information is supposed to be represented there. I'm guessing index: is the name you're giving to the index, but the rest I can't get a lead on. Also, I'm unsure of how you would normally implement these index's into a rails app, ie. what type of files are they normally put into.

Thanks in advance for any help!

2 Answers

In case you are usign ROR,

You can create index on a particular model by running on rails console - CTRL+C

MODEL_NAME.import force: true

Related