【发布时间】:2020-11-20 07:07:51
【问题描述】:
有没有办法获取搜索字符串的出现总数而不是结果命中数?
我的数据结构与嵌套文档有点复杂,但我在下面添加了一个简单版本的数据。如果有人能够帮助找到这方面的计数,我可以将其转换为我的代码版本。
弹性搜索数据是:
[
{
"page": 1,
"text": "Sample PDF Document.\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
},
{
"page": 2,
"text": "sample PDF sample Document test content"
},
{
"page": 3,
"text": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\n sample content"
},
{
"page": 4,
"text": "PDF test sample Document lorem ipsum sample.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. Sample content."
},
{
"page": 5,
"text": "PDF Document"
},
{
"page": 6,
"text": "sdsd"
},
{
"page": 7,
"text": "lorem ipsum"
}
]
我能够获得过滤器聚合,但文本 sample PDF sample Document test content 将返回计数为 1,但单词 sample 在同一字段中出现两次。
【问题讨论】:
标签: elasticsearch elastic-stack elasticsearch-5 elasticsearch-aggregation elasticsearch-dsl