我有一个查询,我使用 search_type 作为
GET /test_videos/_search?search_type=dfs_query_then_fetch&explain=true
{
"query": {
"bool": {
"must": {
"multi_match": {
"query": "funny",
"fields": ["title"]
}
}
}
}
}
效果很好,并给出了我想要的结果。
我也可以像这样在正文中指定解释:
GET /test_claim_videos/_search?search_type=dfs_query_then_fetch
{ "explain" : true,
"query": {
"bool": {
"must": {
"multi_match": {
"query": "funny",
"fields": ["title", "asset_name", "description", "tags.name", "asset_group_name.humanized", "credit"]
}
}
}
}
}
但我想在正文中将 search_type 指定为 dfs_then_fetch 。如果我做
GET /test_claim_videos/_search
{ "search_type" : "dfs_query_then_fetch",
"explain" : true,
"query": {
"bool": {
"must": {
"multi_match": {
"query": "funny",
"fields": ["title", "asset_name", "description", "tags.name", "asset_group_name.humanized", "credit"]
}
}
}
}
}
它引发错误:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "Unknown key for a VALUE_STRING in [search_type].",
"line": 1,
"col": 19
}
],
"type": "parsing_exception",
"reason": "Unknown key for a VALUE_STRING in [search_type].",
"line": 1,
"col": 19
},
"status": 400
}
为什么我不能在正文中指定搜索类型以及如何解决?我需要它在正文中,因为我正在使用不允许传递 URL 的第三方宝石耐嚼。