2014-09-12 34 views
-1
client.indices.putMapping({ 
    "index": "test", 
    "type": "persons", 
    "body": { 
    "mappings": { 
     "properties": { 
     "mname": { 
      "type": "string", 
      "store": true 
     } 
     } 
    } 
    } 
}, callback) 

我收到此錯誤:putmapping彈性檢索算法不是JS API工作

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) 

節點模塊elasticsearch版本2.4.2 elasticsearch服務器1.3.2

+0

您是否檢查過您的json至少有效? – eliasah 2014-09-13 07:52:15

+1

謝謝eliasah, – 2014-09-13 08:37:33

+0

我發現我的錯誤,我沒有在putmapping內寫JSON字段它應該是{「index」:「test」,「type」:「persons」,「body」:{「persons」:{屬性「:{」mname「:{」type「:」string「,」store「:true}}}}},它現在的工作發現 – 2014-09-13 08:41:38

回答

1

拋出的MapperParsingException Elasticsearch意味着您的JSON中存在錯誤。

所以當它發生時,你應該首先檢查你的JSON是否有效。