最近学习es,先是在图书馆借了几本书,但是发现与es现在的版本相差太远了,所以就选择直接在网上看The Definitive Guide,感觉这本书讲得倒还挺好,不过在看到这个地方的时候,按照书上的代码总是出现错误:
{
"error" : {
"root_cause" : [ {
"type" : "query_parsing_exception",
"reason" : "Failed to parse",
"index" : "megacorp"
} ],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [ {
"shard" : 0,
"index" : "megacorp",
"node" : "yZnpVEOVSl-4Q6fyrU-1EQ",
"reason" : {
"type" : "query_parsing_exception",
"reason" : "Failed to parse",
"index" : "megacorp",
"caused_by" : {
"type" : "json_parse_exception",
"reason" : "Unexpected character (':' (code 58)): was expecting comma to separate ARRAY entries\n at [Source: [B@29d143; line: 1, column: 35]" }
莫名其妙地不知道哪里错了,无奈只好在stackflow上向大神发问,最后得知是书上的代码错了。。。要把中括号换成大括号。。于是这个世界安静了