dman
dman

Reputation: 11064

Elasticsearch Rivers- How to make the normal index with river index?

I successfully created a Elastic search river to my MongoDB.

This is the index that I used/created:

{
    "type": "mongodb",
    "mongodb": {
        "collection": "config_files", 
        "db": "tore_dev"
    },
    "index": {
        "name": "mongo_index",
        "type": "config_files"
    }
}

curl -X PUT "localhost:9200/_river/config_files/_meta" -d @create.json

Since I am using a river, my index is not the same as a normal index. I still need to create a index for the fields of the documents on the MongoDB(I think, right?). They are:

{
    "_id" : ObjectId("524fdd575e0000cc"),
    "_type" : "DeviceConfig",
    "created_at" : ISODate("2013-09-24T17:00:58.94Z"),
    "updated_at" : ISODate("2013-09-24T17:00:58.91Z"),
    "device_id" : ObjectId("523d6a4aba001947"),
    "name" : "version",
    "checksum" : "",
    "content" : " blah blah blah...alot of text words"
    "current" : true,
    "retain" : false,
    "standard" : false,
    "legacy" : false

How would I create this index in a river index? I assume it has to do with elasticsearch-mapper-attachments but not clear on how to make this index.

Upvotes: 0

Views: 383

Answers (1)

John Petrone
John Petrone

Reputation: 27487

You do not need to create a separate index. The purpose of the river is to continuously update the Elasticsearch index with data from mongodb via the oplog. Once you create the river that's it -

What you should be doing is querying the Elasticsearch cluster to see that the index exists:

curl -XGET 'http://localhost:9200/_aliases?pretty'

I'd also then query the index:

curl -XGET 'localhost:9200/mongo_index/_search?q=*&pretty'

EDIT

If your are looking to set or adjust the analyzer for a specific field, you will need to create the index and the mappings prior to setting up your river. This previous question has some details on how to do this:

mapping in create index in elasticsearch through mongodb river is not taking effect

Upvotes: 1

Related Questions