如果将ignore_malformed 字符串设置为false。如果文档格式不正确,但会引发异常,则不会索引该文档。至少在elasticsearch 1.6.0中。
例:
put testput test/test/_mapping { "properties" : { "title" : {"type" : "string"}, "data" : {"type": "long" ,"ignore_malformed":false} }}put test/test/1{ "data" : "1", "title" : "valid coerce string to number"}put test/test/2{ "data" : "hello", "title" : "invalid number"}#Failed Response{ "error": "MapperParsingException[failed to parse [data]]; nested: NumberFormatException[For input string: "hello"]; ", "status": 400}Query with Get failsget test/test/2{ "_index": "test", "_type": "test", "_id": "2", "found": false}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)