为了开始使用elasticsearch和kibana,我尝试了这个教程。但是现在我得到了一个我自己解决不了的错误。
它与这个非常相似:elasticsearch bool query combine must with OR
但Daniel Fackrell的解决方案对我不起作用,我显然遗漏了一些东西。我的代码:
POST shakespeare/scene/_search/
{
"query": {
"bool": {
"must": [
{
"match": {
"play_name": "Antony"
},
"bool": {
"should": [
{
"match": {
"speaker": "Demetrius"
}
},
{
"match": {
"speaker": "Antony"
}
}
]
}
}
]
}
}
}
但随后我得到了以下错误:“匹配格式错误的查询,期望的END_OBJECT,但找到了FIELD_NAME”
在找了几个小时后,我希望有人能帮助我。
我使用的是版本5.6.4。
提前感谢!
关于Greg的善意
发布于 2017-11-16 07:08:10
我想你漏掉了一个括号。检查下面的查询。
POST shakespeare/scene/_search/
{
"query": {
"bool": {
"must": [
{
"match": {
"play_name": "Antony"
}
},
{
"bool": {
"should": [
{
"match": {
"speaker": "Demetrius"
}
},
{
"match": {
"speaker": "Antony"
}
}
]
}
}
]
}
}
}
https://stackoverflow.com/questions/47315227
复制