我想在 Elasticsearch 7.3 中存储的文档中搜索单词
我希望在以前版本的 Elasticsearch 上运行的一个示例是:
{
"query": {
"bool": {
"must": [
{
"match": {
"_all": "oliver"
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"aggs": {}
}
Run Code Online (Sandbox Code Playgroud)
但此查询在 Elasticsearch 7+ 上不起作用,因为_all已被删除。既然该_all字段消失了,我该如何编写查询来完成同样的事情呢?
注意:我已阅读用于将所有字段复制到自定义字段的建议copy_to,但这需要显式写出每个字段以包含在 all_fields 字段中。由于我有很多小字段,我试图避免这种情况,而是复制能够查询 _all 允许的行为。