[英]elasticsearch bool query error in php client
ElasticSearch returns me [_na] query malformed, no field after start_object
error when trying to look up entries using the following query. ElasticSearch返回我的
[_na] query malformed, no field after start_object
错误,尝试使用以下查询查找条目时[_na] query malformed, no field after start_object
错误[_na] query malformed, no field after start_object
。 The field localtime is a new field of documents and exist in every document. 本地时间字段是文档的新字段,并且存在于每个文档中。
php code, php代码,
$qryurl = '<myurl>:<myport>/index/_search?pretty';
$data = array(
"query" => array(
"bool" => array(
"must" => array(
"range" => array(
"localtime" => array(
"from" => "2016-06-15T17:43:04.923Z",
"to" => "2016-06-17T17:43:04.923Z",
"include_lower" => "true",
"include_upper" => "true"
)
),
"term" => array(
"query" => "1.2.3.4",
"fields" => array("ip")
),
"query_string" => array(
"query" => "*up*",
"default_field" => array("_all")
)
)
)
);
Why does this error appear? 为什么会出现此错误?
anyhelp will be appreciated ! 任何帮助将不胜感激 ! thanks!
谢谢!
Your bool/must
clause must be a pure array not an associative array: 您的
bool/must
子句必须是纯数组,而不是关联数组:
$qryurl = '<myurl>:<myport>/index/_search?pretty';
$data = array(
"query" => array (
"bool" => array (
"must" => array(
array(
"range" => array (
"localtime" => array (
"from" =>"2016-06-15T17:43:04.923Z",
"to" => "2016-06-17T17:43:04.923Z",
"include_lower" => "true",
"include_upper" => "true"
)
)
),
array(
"term" => array(
"ip" => "1.2.3.4"
)
),
array(
"query_string" => array(
"query" => "*up*",
"default_field" => "_all"
)
)
)
)
)
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.