0
votes

I created an index

curl -XPUT 'http://localhost:9200/tipindex/' -d '{
     "settings" : {
        "index" : {
            "number_of_shards" : 1,
            "number_of_replicas" : 1,
          }
     }
  }
}'

and then I associated a river with the index using the following command :

curl -XPUT "localhost:9200/_river/tipindex/_meta" -d '
{
"type": "mongodb",
"mongodb": {
    "host": "<machine-name>",
    "port": "27017",
    "db": "mydb",
    "collection": "tips"
},
"index": {
    "name": "tipindex",
    "type": "tips"
 }
}'

The index is properly created and all the documents are indexed. However, if I delete the index using :

curl -XDELETE '<machine-name>:9200/tipindex/'

It completes with {"ok":true,"acknowledged":true}

ES log : [tipindex] deleting index

Now if I execute curl -XDELETE 'localhost:9200/tipindex/'

{"error":"IndexMissingException[[tipindex] missing]","status":404}

which means that index is deleted.

But if I restart elasticsearch the index is created again with 0 documents and no mapping.

If I recreate the index and associate a river, then no documents are indexed. ES log do not show any error as well.

Now my questions are :

  • Why is the index not getting deleted ?
  • When I recreate the index,why are the documents not getting indexed again?
  • How can I delete an index forcefully?
1

1 Answers

0
votes

It's probably due to mongo river.

Why is the index not getting deleted ?

It does recreate the index each time you restart the river if the index does not exist.

When I recreate the index,why are the documents not getting indexed again?

I think that Mongo river store in _river/tipindex index the last fetch point. As you already run the river, something is remaining in it. You can check all documents remaining in this index:

curl localhost:9200/_river/tipindex/_search?q=*

If you need to restart the river, the best option is to me to remove and recreate the river as you did before.

HTH