[英]Update query is not getting reflected on index
我正在尝试更新索引,但它并没有像控制台日志中显示的那样得到更新,它更新但没有反映在 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);
在 function 中传递此数据
{
isBase64Encoded: false,
statusCode: 200,
statusDescription: '200 OK',
headers: {
'Set-cookie': 'cookies',
'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Origin': 'https://dev.titlemanagerfeature.warnerbros.com',
'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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.