Arun Mohan
Arun Mohan

Reputation: 978

Index not getting created in Elasticsearch

This is my code which Im using to index some data. But,when I search for the index,in elasticsearch it is not getting created there.

var createIndex = function(refId,docFeed){
    esClient.create({
        index:"indexName",
        type:"typeName",
        id:refId,
        body:docFeed    
    },
        function(error,response){
            emptyFunction();
    });

}

Can anybody help me on this?

Upvotes: 0

Views: 670

Answers (2)

TheWhiteRabbit
TheWhiteRabbit

Reputation: 15768

Index names are limited by the file system. They may only be lower case, and my not start with an underscore. While we(elasticsearch) don't prevent index names starting with a ., we(elasticsearch) reserve those for internal use. Clearly, . and .. cannot be used.

source

Change your code to

var createIndex = function(refId, docFeed) {
    esClient.create({
        index: "indexname",
        type: "typename",
        id: refId,
        body: docFeed
      },
      function(error, response) {
        emptyFunction();
      });

Upvotes: 3

Vineeth Mohan
Vineeth Mohan

Reputation: 19283

I presume the problem is with your index name. Elasticsearch doesnt allow,capital letters in index name and type creation. So better try with index name and type names with lower case.

Upvotes: 0

Related Questions