我正在调试网站搜索功能,其分页结果在任意数量的网页后失败。
search: Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.
但是,我确信它正在使用索引:
winningPlan:
{ stage: 'PROJECTION',
transformBy:
{ score: { '$meta': 'textScore' },
shootId: 1,
title: 1,
publishDate: 1,
'media.images.indexImage': 1,
'media.images.adImage': 1,
'media.images.galleryImages': 1,
'media.images.portrait': 1,
'media.promos.images.410': 1,
'media.full.full.length': 1,
contentProducer: 1,
performers: 1,
site: 1 },
inputStage:
{ stage: 'TEXT',
indexPrefix: {},
indexName: 'textSearchIndex',
parsedTextQuery:
{ terms: [ 'milk' ],
negatedTerms: [],
phrases: [],
negatedPhrases: [] },
textIndexVersion: 3,
inputStage:
{ stage: 'TEXT_MATCH',
inputStage:
{ stage: 'TEXT_OR',
filter:
{ '$and':
[ { 'status.publishStatus': { '$eq': 'PUBLISHED' } },
{ publishDate: { '$lte': 2017-03-17T21:30:29.254Z } } ] },
inputStage:
{ stage: 'IXSCAN',
keyPattern:
{ _fts: 'text',
_ftsx: 1,
'status.publishStatus': 1,
publishDate: -1 },
indexName: 'textSearchIndex',
isMultiKey: true,
isUnique: false,
isSparse: false,
isPartial: false,
indexVersion: 2,
direction: 'backward',
indexBounds: {} } } } } },
rejectedPlans: [] },
该集合约1gb,35k物体,平均大小28.3 KiB。
指数,即22.8 MiB:
{
"description" : "text",
"performers.performerName" : "text",
"site.shortName" : "text",
"summary" : "text",
"title" : "text",
"status.publishStatus" : 1,
"publishDate" : -1
}
查询:
{
'status.publishStatus': 'PUBLISHED',
'publishDate': {
'$lte': new Date("Fri, 17 Mar 2017 21:30:29 GMT")
},
'$text': {
'$search': 'milk'
}
}
排序:
{
score: {
$meta: 'textScore'
},
publishDate: -1
}
实际上,它正在进行查找,排序,跳过,限制,精益,选择和最终执行。
它实际上已编入索引吗?如果不是,我该怎么办?
如果它被编入索引,我应该增加internalQueryExecMaxBlockingSortBytes吗?