我是新手并在我的服务器上安装了es2.3.1。但是当我在网站上阅读The Definitive Guide时,我发现了一个例子,我的服务器上出现了错误。 Here是链接,错误如下:
{
"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]"
}
我搜索了这个问题,发现了一些像this这样的类似问题,但遗憾的是它不起作用。令我困惑的是,虽然我复制了本书的代码但仍然出错。任何人都可以帮助我吗?非常感谢!
答案 0 :(得分:2)
似乎在例子中有一个拼写错误。您需要使用大括号更改方括号:
GET /megacorp/employee/_search
{
"query" : {
"bool": {
"must": {
"match" : {
"last_name" : "smith"
}
},
"filter": {
"range" : {
"age" : { "gt" : 30 }
}
}
}
}
}