索引上"/>
更新查询未反映在索引上
我正在尝试更新索引,但是它没有得到更新,就像它在控制台日志中显示的那样,它已更新但没有反映在elasticsearch查询中,如果我在控制台上检查它是否已更新,而不是在elasticseach查询中。谁能帮助我我错了?
updateProjectIndex = async (project) => {
try{
client.update({
index: constants.searchIndexes.project,
type: "project",
id: project.titles.title_id,
refresh: 'true',
body: project,
});
}
catch(e) {
console.log(e);
}
}
这是从其他文件中调用。
var elasticData= JSON.parse(result.body);
elasticData = elasticData.res;
console.log(elasticSearch_common);
elasticSearch_common.updateProjectIndex(elasticData);
在函数中传递此数据
{
isBase64Encoded: false,
statusCode: 200,
statusDescription: '200 OK',
headers: {
'Set-cookie': 'cookies',
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Origin': '',
'Access-Control-Allow-Methods': '*',
'Content-Type': 'application/json'
},
body: '{"error":null,"res":{ producers: [], writers: [ '34422' ], createdBy: 'Joe', _id: 3467288288282, alternate: [ { is_main: false, sort_order: 1, _id: 23, alternate_title_id: 23 }, { is_main: true, sort_order: 0, _id: 23, alternate_title_id: 23 } ], titles: [ { _id: 21, title_id: sadadsadadsdsd } ], projectName: "Project Example", __v: "36"}}',
id: undefined
}
回答如下:您的更新电话不正确。应该是这样的:
const result = await client.update({
index: constants.searchIndexes.project,
type: "project",
id: project.titles.title_id,
refresh: 'true',
body: {
doc: project
}
});
return result;
更多推荐
更新查询未反映在索引上
发布评论