Rajit Garg
Rajit Garg

Reputation: 539

putmapping elastic serach not working with js api

client.indices.putMapping({
  "index": "test",
  "type": "persons",
  "body": {
    "mappings": {
      "properties": {
        "mname": {
          "type": "string",
          "store": true
        }
      }
    }
  }
},  callback)

I am getting this error:

MapperParsingException[Root type mapping not empty after parsing! Remaining fields:   
  [
    mappings : {
      properties={ 
        mname= { 
          type=string, 
          store=true
        }
      }
    }
  ]
] 
Error: MapperParsingException[Root type mapping not empty after parsing! Remaining fields:
  [
    mappings : {
      properties={
        mname= {
          type=string,
          store=true
        }
      }
    }
  ]
] 
  at respond (/home/rajit/IdeaProjects/Applane/node_modules/elasticsearch/src/lib/transport.js:234:15)     
  at checkRespForFailure (/home/rajit/IdeaProjects/Applane/node_modules/elasticsearch/src/lib/transport.js:202:7)     
  at HttpConnector.<anonymous> (/home/rajit/IdeaProjects/Applane/node_modules/elasticsearch/src/lib/connectors/http.js:148:7)     
  at IncomingMessage.bound (/home/rajit/IdeaProjects/Applane/node_modules/elasticsearch/node_modules/lodash-node/modern/internals/baseBind.js:56:17)     
  at IncomingMessage.emit (events.js:117:20)     
  at _stream_readable.js:943:16     
  at process._tickCallback (node.js:419:13)

node module elasticsearch version is 2.4.2 elasticsearch server is 1.3.2

Upvotes: 0

Views: 1472

Answers (1)

eliasah
eliasah

Reputation: 40360

The MapperParsingException that throws Elasticsearch means always that there is a mistake in your JSON.

So when it's occured, you should first check if your JSON is valid.

Upvotes: 2

Related Questions