mongodb - Mongodb Atlas Search Autocomplete is slow on sort with large data set
问题描述
I have used an atlas search for finding Hashtags. I would like to sorting on t_status and count fields. t_status field does not exist in most of documents but it has exist in some documents.
Hashtags save in _id field.
search autocomplete index :
{
"mappings": {
"dynamic": false,
"fields": {
"_id": {
"foldDiacritics": false,
"maxGrams": 10,
"minGrams": 1,
"tokenization": "edgeGram",
"type": "autocomplete"
}
}
}
}
Search aggregate query :
[
{
'$search': {
'index': 'default',
'autocomplete': {
'query': 'a',
'path': '_id'
}
}
}, {
'$sort': {
't_status': -1,
'count': -1
}
}, {
'$limit': 20
}
]
Above search query slow on sorting with huge data set.
Anyone can Give me the solution of this question?
解决方案
推荐阅读
- javascript - 绑定到 vue v-model 的 bootstrap-datepicker 在失去焦点时恢复到以前的数据
- c++ - 为什么一个非常大的值会导致这段代码无限重复?
- r - 生成一个介于 0 和 1 之间的向量,具有一定长度和一定数量的 1
- grails - 我正在尝试在 grails 项目上使用 Spring Security Core,出现以下错误
- visual-studio - 如何在我的 UWP 应用中运行特定页面?
- python-3.x - 使用 Pandas 重命名文件 - 值错误的真相
- python - MNIST 数据集结构
- express - 快速验证结果的正确 Typescript 类型是什么?
- c++ - SDL 2 位图 BMP 文件
- sharepoint - sharepoint 2016 webpart 可以在sharepoint 2013 中使用吗?