gpt4 book ai didi

elasticsearch搜索查询返回 "hits"空白

转载 作者:行者123 更新时间:2023-12-02 23:54:04 27 4
gpt4 key购买 nike

我对 Elasticsearch 相当陌生,我一直在尝试对我的数据进行搜索,并且总是让点击部分为空。即使在数据上传和索引之后也会发生这种情况。我的映射如下:

{
"mappings":{
"type":{
"properties":{
"adoriId":{
"type":"integer"
},
"custom":{
"type":"nested",
"properties":{
"timestamp":{
"type":"text"
},
"value":{
"type":"text"
}
}
}
}
}
}
}

我需要为搜索的文本获取相关的时间戳值。我使用的搜索查询(使用 postman )

获取 http://localhost:9200/transcripts/type/_search
{
"query":{
"match":{
"custom.value":"iTunes to rate review And subscribe"
}
}
}

我所做的任何搜索都会返回这个
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

最佳答案

字段custom属于 Nested Datatype您需要使用Nested Query .

以下是您的查询必须是:

GET transcripts/_search
{
"query":{
"nested":{
"path":"custom",
"query":{
"match":{
"custom.value":"iTunes to rate review And subscribe"
}
},
"inner_hits":{}
}
}
}

关于elasticsearch搜索查询返回 "hits"空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55240352/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com