elasticsearch查询不支持query_string?
elasticsearch query does not support query_string?
ElasticSearch returns 我 "query_parsing_exception","reason":[bool] query does not support " 尝试使用以下 query.i 查找条目时出现错误问题是关于 "query_string"
curl -XGET '<myurl>:<myport>/index/_search?pretty' -d '
{
"query": {
"bool": {
"must":[ {
"term" : {
"query" : "1.2.3.4",
"fields" : [ "ip" ]
}
},{
"range" : {
"localtime" : {
"from" : "2016-06-15T06:00:04.923Z",
"to" : "2016-06-17T17:43:04.923Z",
"include_lower" : true,
"include_upper" : true
}
}
},
"query_string" : {
"default_field" : "_all",
"query" : "word1 OR word1",
} ]
}
}
}'
为什么会出现这个错误?
谢谢
任何帮助将不胜感激!谢谢!
正确设置查询格式通常会有所帮助。在您的情况下,您在 query_string
之前缺少一个大括号,并且在 query_string 查询之后有一个逗号太多。
像这样重新格式化会起作用:
curl -XGET '<myurl>:<myport>/index/_search?pretty' -d '
{
"query": {
"bool": {
"must": [
{
"term": {
"ip": "1.2.3.4"
}
},
{
"range": {
"localtime": {
"from": "2016-06-15T06:00:04.923Z",
"to": "2016-06-17T17:43:04.923Z",
"include_lower": true,
"include_upper": true
}
}
},
{
"query_string": {
"default_field": "_all",
"query": "word1 OR word1"
}
}
]
}
}
}'
ElasticSearch returns 我 "query_parsing_exception","reason":[bool] query does not support " 尝试使用以下 query.i 查找条目时出现错误问题是关于 "query_string"
curl -XGET '<myurl>:<myport>/index/_search?pretty' -d '
{
"query": {
"bool": {
"must":[ {
"term" : {
"query" : "1.2.3.4",
"fields" : [ "ip" ]
}
},{
"range" : {
"localtime" : {
"from" : "2016-06-15T06:00:04.923Z",
"to" : "2016-06-17T17:43:04.923Z",
"include_lower" : true,
"include_upper" : true
}
}
},
"query_string" : {
"default_field" : "_all",
"query" : "word1 OR word1",
} ]
}
}
}'
为什么会出现这个错误?
谢谢
任何帮助将不胜感激!谢谢!
正确设置查询格式通常会有所帮助。在您的情况下,您在 query_string
之前缺少一个大括号,并且在 query_string 查询之后有一个逗号太多。
像这样重新格式化会起作用:
curl -XGET '<myurl>:<myport>/index/_search?pretty' -d '
{
"query": {
"bool": {
"must": [
{
"term": {
"ip": "1.2.3.4"
}
},
{
"range": {
"localtime": {
"from": "2016-06-15T06:00:04.923Z",
"to": "2016-06-17T17:43:04.923Z",
"include_lower": true,
"include_upper": true
}
}
},
{
"query_string": {
"default_field": "_all",
"query": "word1 OR word1"
}
}
]
}
}
}'