【发布时间】:2021-05-11 05:37:15
【问题描述】:
我在 elasticsearch 中搜索时遇到问题。每当我尝试按以下 curl 之类的术语进行搜索时,都会得到我想要的结果。
curl --location --request GET 'http://xx.xx.xx.xx:xxxx/XXXXXX/_search' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": {
"term": {
"time": {
"value": "2021-02-09T00:09:49.457Z",
"boost": 1.0
}
}
}
}
'
响应示例。该类型表示 _doc,因此嵌套查询应该以相同的方式工作。
{"hits": [
{
"_index": "XXXX",
"_type": "_doc",
"_id": "xxxxx",
"_score": 1.0,
"_source": { ... }
]}
但是,当我尝试搜索嵌套键时,我在响应中得到 0 次点击。
curl --location --request GET 'http://xx.xx.xx.xx:xxxx/XXXXXX/_search' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": {
"term": {
"code.type": {
"value": "animals",
"boost": 1.0
}
}
}
}
知道可能出了什么问题吗?
【问题讨论】:
-
查看索引映射会很有用。
标签: elasticsearch dsl elasticsearch-query