Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch Elasticsearch-搜索类型作为主体参数_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch Elasticsearch-搜索类型作为主体参数,elasticsearch,elasticsearch" /> elasticsearch Elasticsearch-搜索类型作为主体参数,elasticsearch,elasticsearch" />

elasticsearch Elasticsearch-搜索类型作为主体参数

elasticsearch Elasticsearch-搜索类型作为主体参数,elasticsearch,elasticsearch,我有点反对将search_type指定为body参数。作为一个查询参数,它很好用,但在手册中找不到一个将其指定为查询参数的示例 POST /index/type/_search { "search_type": {"query_then_fetch"}, "explain": false, "query" : { "query_string": { "default_field": "adress.city",

我有点反对将search_type指定为body参数。作为一个查询参数,它很好用,但在手册中找不到一个将其指定为查询参数的示例

POST /index/type/_search
{
 "search_type": {"query_then_fetch"}, 
 "explain": false,
     "query" : { 
         "query_string": {
            "default_field": "adress.city",
            "query": "London"
         }
     }
}
有什么提示吗


Thx

不支持从以下位置将搜索类型放入正文:

可以通过在中设置search_type参数来配置该类型 查询字符串

因此,您的查询应该如下所示:

curl -XGET http://localhost:9200/index/type/_search?search_type=query_then_fetch -d '
{
 "explain": false,
     "query" : { 
         "query_string": {
            "default_field": "adress.city",
            "query": "London"
         }
     }
}'
是,从,
在上述[参数]中,搜索类型和请求缓存必须作为查询字符串参数传递
不能在正文内传递。您有
{:“query\u then\u fetch”}
,您可能是指
{“query\u then\u fetch”}
(不带分号)