Hi so when I want to update an already existing document it throws a document_missing_exception
backend: ==========ERROR=========
ResponseError: document_missing_exception: [document_missing_exception] Reason: [_doc][de5feb89-4613-4687-a473-f9f69c5e9895]: document missing
backend: at onBody (C:\00.Partable\dds-launchpad-iiot-cloud-pcs\src\target-solution-ui\packages\backend\node_modules\@elastic\elasticsearch\lib\Transport.js:367:23)
backend: at IncomingMessage.onEnd (C:\00.Partable\dds-launchpad-iiot-cloud-pcs\src\target-solution-ui\packages\backend\node_modules\@elastic\elasticsearch\lib\Transport.js:291:11)
backend: at IncomingMessage.emit (node:events:529:35)
backend: at IncomingMessage.emit (node:domain:489:12)
backend: at endReadableNT (node:internal/streams/readable:1400:12)
backend: at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {backend: meta: {
backend: body: { error: [Object], status: 404 },
backend: statusCode: 404,
backend: headers: {
backend: 'content-length': '407',
backend: 'content-type': 'application/json; charset=UTF-8',
backend: 'x-cloud-request-id': 'pB_DQgtxT-myaE-p05twGg',
backend: 'x-elastic-product': 'Elasticsearch',
backend: 'x-found-handling-cluster': '8c44a25e3c884a83bbb89699468f11f3',
backend: 'x-found-handling-instance': 'instance-0000000013',
backend: date: 'Tue, 19 Nov 2024 05:37:04 GMT'
backend: },
backend: meta: {
backend: context: null,
backend: request: [Object],
backend: name: 'elasticsearch-js',
backend: connection: [Object],
backend: attempts: 0,
backend: aborted: false
backend: }
backend: }
backend: }
But when I query for the document in the index it is present
And it does not have any routing as well so that would not be causing the error
Below is my code where I try to update the document
export async function updateDocumentInIndex(esurl, indexName, sourceExpressions, paramsExpressions, idString) {
try {
const esClient = new elasticsearch.Client({
node: esurl,
requestTimeout: 300000, // Set request timeout to 30 seconds (30000 ms)
headers: { 'Content-Type': 'application/json' }
});
var body;
console.log("================ID STRING================",idString);
if (idString.length > 0) {
body = await esClient.update({
index: indexName,
id: idString,
body: {
script: {
source: sourceExpressions,
lang: 'painless',
params: paramsExpressions
}
},
refresh: true
})
} else {
body = await esClient.index({
index: indexName,
body: jsonBody,
refresh: true
})
}
// console.log(body)
return body;
} catch (err) {
console.log("============SOURCE EXPRESSIONS==========",sourceExpressions);
console.log("============PARAMS EXPRESSIONS==========",paramsExpressions);
console.log("==========ERROR=========",err);
return err;
}
}
Below is the query I constructed to search for the document in the index
{
"query":{
"term":{
"_id":"de5feb89-4613-4687-a473-f9f69c5e9895"
}
}
}
And below is the response from elastic
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "activity-log",
"_id": "de5feb89-4613-4687-a473-f9f69c5e9895",
"_score": 1,
"_source": {
"taskID": "de5feb89-4613-4687-a473-f9f69c5e9895",
"startTime": 1731994127,
"family": "Deploy",
"name": "PreProduction",
"user": {
"id": "c49fee8f-abae-4ab0-a024-8a5d24e3d72e",
"userId": "e77ad63662aa4945aba46d8fc7e2fd3d",
"isActive": true,
"userFirstName": "DKSAN",
"userFullName": "DKSAN AUG",
"email": "ca_dkaug_dev@mailinator.com",
"organizationId": "bfa08e3b-2c81-4ad4-935b-6384358301d6",
"organizationName": "DK AUG",
"organizationAlias": "dkaug202407301008",
"name": "Customer Admin",
"scopes": {
"PARTABLE_ORGANIZATION": [
"READ"
],
"USER_MANAGEMENT": [
"CREATE",
"READ",
"UPDATE",
"DELETE"
],
"PERSONA_MANAGEMENT": [
"READ"
],
"PRODUCT": [
"UPLOAD",
"DOWNLOAD",
"READ",
"DELETE",
"CREATE",
"UPDATE"
],
"BOM": [
"UPLOAD",
"DOWNLOAD",
"READ",
"DELETE"
],
"ASSETS": [
"UPLOAD",
"DOWNLOAD",
"READ",
"DELETE",
"CREATE",
"UPDATE"
],
"THEMES": [
"READ"
]
},
"userScopes": []
},
"domain": "dkaug202407301008",
"workSpaceId": "wsdka1731955038256",
"mustNotify": true,
"notified": false,
"isNewPublish": true,
"forDeploy": true,
"dataMinimumPresent": true,
"dataSufficient": false,
"dataComplete": false,
"operativeFiles": {
"headerValidationCheck": [],
"org": [
{
"orgID": "dkaug202407301008",
"userID": "dkaug202407301008",
"fileID": "1ad0d285-8cb5-4c50-a921-53b401dff7a7",
"fileName": "2d-3d-single-org-facet-organizations.csv",
"fileType": "csv",
"version": 31,
"assetType": "org",
"workSpaceId": "wsdka1731955038256",
"status": "checked-in",
"twoDAsset": false,
"uploadedOn": 1731993940,
"uploadedBy": "DKSAN AUG",
"isActive": true,
"csv_type": "uploadhistory.files",
"_id": "2d-3d-single-org-facet-organizations.csv|31|wsdka1731955038256|uploadhistory.files"
}
],
"bom": [
{
"orgID": "dkaug202407301008",
"userID": "dkaug202407301008",
"fileID": "eb67d9aa-e2fc-4580-a14c-c30836705dc9",
"fileName": "2d-3d-single-org-facet-bomInformation.csv",
"fileType": "csv",
"version": 22,
"assetType": "bom",
"workSpaceId": "wsdka1731955038256",
"status": "checked-in",
"twoDAsset": false,
"uploadedOn": 1731994076,
"uploadedBy": "DKSAN AUG",
"isActive": true,
"csv_type": "uploadhistory.files",
"_id": "2d-3d-single-org-facet-bomInformation.csv|22|wsdka1731955038256|uploadhistory.files"
}
],
"pds": [
{
"orgID": "dkaug202407301008",
"userID": "dkaug202407301008",
"fileID": "39461a87-9b6b-4c2c-97ad-47dd17a8171a",
"fileName": "2d-3d-single-org-facet-productsSold.csv",
"fileType": "csv",
"version": 17,
"assetType": "pds",
"workSpaceId": "wsdka1731955038256",
"status": "checked-in",
"twoDAsset": false,
"uploadedOn": 1731994035,
"uploadedBy": "DKSAN AUG",
"isActive": true,
"csv_type": "uploadhistory.files",
"_id": "2d-3d-single-org-facet-productsSold.csv|17|wsdka1731955038256|uploadhistory.files"
}
],
"cat": [],
"pdm": [
{
"orgID": "dkaug202407301008",
"userID": "dkaug202407301008",
"fileID": "7efe3a94-f3f2-4387-9ec5-d625da7fd51f",
"fileName": "2d-3d-single-org-facet-product.csv",
"fileType": "csv",
"version": 22,
"assetType": "pdm",
"workSpaceId": "wsdka1731955038256",
"status": "checked-in",
"twoDAsset": false,
"uploadedOn": 1731993895,
"uploadedBy": "DKSAN AUG",
"isActive": true,
"csv_type": "uploadhistory.files",
"_id": "2d-3d-single-org-facet-product.csv|22|wsdka1731955038256|uploadhistory.files"
}
],
"ctl": [],
"ast": []
},
"status": {},
"response": [
{
"success": true,
"stats": {
"time": 1731994422,
"headerValid": true,
"scanned": 2,
"invalid": 0,
"valid": 2,
"inserted": 2,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-organizations.csv",
"version": 31,
"id": "1ad0d285-8cb5-4c50-a921-53b401dff7a7"
}
},
"invalidRows": []
},
{
"success": true,
"stats": {
"time": 1731994496,
"headerValid": true,
"scanned": 47,
"invalid": 0,
"valid": 47,
"inserted": 47,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-product.csv",
"version": 22,
"id": "7efe3a94-f3f2-4387-9ec5-d625da7fd51f"
}
},
"invalidRows": []
},
{
"success": true,
"stats": {
"time": 1731994502,
"headerValid": true,
"scanned": 6,
"invalid": 0,
"valid": 6,
"inserted": 6,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-productsSold.csv",
"version": 17,
"id": "39461a87-9b6b-4c2c-97ad-47dd17a8171a"
}
},
"invalidRows": []
},
{
"success": true,
"stats": {
"time": 1731994510,
"headerValid": true,
"scanned": 40,
"invalid": 0,
"valid": 40,
"inserted": 40,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-bomInformation.csv",
"version": 22,
"id": "eb67d9aa-e2fc-4580-a14c-c30836705dc9"
}
},
"invalidRows": []
}
],
"deployResponse": [
{
"success": true,
"stats": {
"time": 1731994422,
"headerValid": true,
"scanned": 2,
"invalid": 0,
"valid": 2,
"inserted": 2,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-organizations.csv",
"version": 31,
"id": "1ad0d285-8cb5-4c50-a921-53b401dff7a7"
}
},
"invalidRows": []
},
{
"success": true,
"stats": {
"time": 1731994496,
"headerValid": true,
"scanned": 47,
"invalid": 0,
"valid": 47,
"inserted": 47,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-product.csv",
"version": 22,
"id": "7efe3a94-f3f2-4387-9ec5-d625da7fd51f"
}
},
"invalidRows": []
},
{
"success": true,
"stats": {
"time": 1731994502,
"headerValid": true,
"scanned": 6,
"invalid": 0,
"valid": 6,
"inserted": 6,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-productsSold.csv",
"version": 17,
"id": "39461a87-9b6b-4c2c-97ad-47dd17a8171a"
}
},
"invalidRows": []
},
{
"success": true,
"stats": {
"time": 1731994510,
"headerValid": true,
"scanned": 40,
"invalid": 0,
"valid": 40,
"inserted": 40,
"updated": 0,
"noop": 0,
"source": {
"name": "2d-3d-single-org-facet-bomInformation.csv",
"version": 22,
"id": "eb67d9aa-e2fc-4580-a14c-c30836705dc9"
}
},
"invalidRows": []
}
],
"validationResponses": {},
"errors": {},
"warnings": {},
"crossReference": {},
"endTime": {
"endTime": 1731994607,
"termination": "normal"
},
"completion": 1731994607
}
}
]
}
}
Why is this happening and how can this be resolved?