ElasticSearch不返回结果
我是个新手,不能解决这个问题 我有两个要求: 1)ElasticSearch不返回结果,search,elasticsearch,Search,elasticsearch,我是个新手,不能解决这个问题 我有两个要求: 1) curl-XGET'host/process\u test\u 1/1/\u search?标题:*新建*' 它还我 { "took": 1, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 116, "max_score": 1.0,
curl-XGET'host/process\u test\u 1/1/\u search?标题:*新建*'
它还我
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 116,
"max_score": 1.0,
"hits": [
{
"_index": "process_test_1",
"_type": "1",
"_id": "7118_folder_1",
"_score": 1.0,
"_source": {
"obj_type": "folder",
"obj_id": 7118,
"title": "sadasd"
}
},
{
"_index": "process_test_1",
"_type": "1",
"_id": "6780_folder_1",
"_score": 1.0,
"_source": {
"obj_type": "folder",
"obj_id": 6780,
"title": "New Object"
}
}
}
]
}
}
为什么它会返回一个标题为“sadasd”的对象
第二个请求
`curl -XGET 'host/process_test_1/1/_search' -d '{"query":{"match":{"text":{"query":"*New*","operator":"and"}}}}`'
它回来了
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": [
]
}
}
如果我真的有一个匹配的元素(实际上我有50多个元素有这样的名称和不同的ID),为什么它不返回任何内容呢?首先,您的第一个查询缺少参数名
q=
curl -XGET 'host/process_test_1/1/_search?q=title:*New*'
^
|
this is missing
其次,match
查询不会将*
字符解释为通配符,因此,如果您希望在上面的第一个查询中使用DSL进行等效查询,则需要使用query\u字符串
查询:
curl -XGET 'host/process_test_1/1/_search' -d '{
"query": {
"query_string": {
"query": "*New*",
"default_field": "text"
}
}
}'
嗨,谢谢!你能帮我回答另一个问题吗?因为多重匹配查询也不能与我使用的“*New*”一起使用?您也可以使用
query\u string
在查询中是否有特殊情况需要使用“空格”?因为他们弹性地改变他的行为并发送另一个结果对于我运行带有“query”的query\u字符串的示例:“*acd”结果中是带有文本“New Object”的对象对不起,我找到了信息