putMapping elasticsearch index not found exception putMapping elasticsearch index not found exception elasticsearch elasticsearch

putMapping elasticsearch index not found exception


If the index does not exist, putMapping() won't help, you need to call indices.create instead. putMapping can only be used to add a new mapping type to an already existing index.

Replace your putMapping call with this:

    elastic.indices.createIndex({        index: "ppvevents",        body: {            mappings: {               ppvObject: {                  properties: {                     name: {type: "string", index: "not_analyzed"},                     hdid: {type: "integer"},                     sdid: {type: "integer"}                  }               }            }        }


new version of elasticsearch.js already removed the elastic.indices.createIndex, you need to use client.indices.create