Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Current version OpenSearch 2.3
Describe the issue:
Unable to index data after upgrading to OS 2.3
Configuration:
Mapping of the index, that I got from running GET smartmeters/_mapping
{
"smartmeters": {
"mappings": {
"properties": {
"address": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"city": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"zipcode": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
we are using this code to index data process.row.js · GitHub
This is part of the code where indexing happens.
let operation = {
index: ES_INDEX_NAME,
type: '_doc',
id: row.my_id,
action: 'index',
body: row,
};
this.push(operation);
Relevant Logs or Screenshots:
The error that I get when the type
param is part of above operation
2023-11-18 ERROR Error processing row in ext.00000203.zip StatusCodeError: [illegal_argument_exception] Action/metadata line [1] contains an unknown parameter [_type]
at respond (/var/task/node_modules/elasticsearch/src/lib/transport.js:308:15)
at checkRespForFailure (/var/task/node_modules/elasticsearch/src/lib/transport.js:267:7)
at done (/var/task/node_modules/http-aws-es/connector.js:48:7)
at IncomingMessage.cleanUp (/var/task/node_modules/http-aws-es/src/node.js:20:7)
at IncomingMessage.emit (node:events:529:35)
at IncomingMessage.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1368:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
status: 400,
displayName: 'BadRequest',
path: '/_bulk',
query: {},
body: '{"index":{"_index":"smartmeters","_type":"_doc","_id":"103561"}}\n' +
'{"my_id":"103561","address":"3382 FM 439","city":"BELTON","zipcode":"76513"}\n'
statusCode: 400,
response: '{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"},"status":400}',
toString: [Function (anonymous)],
toJSON: [Function (anonymous)],
records: [
{ index: [Object] },
{
my_id: '103561',
address: '3382 FM 439',
city: 'BELTON',
zipcode: '76513',
}
... 39 more items
]
}
and if the type
param is removed it results in
2023-11-18 0d21a2a5bdp43 ERROR Error processing row in ext.00000203.zip AssertionError [ERR_ASSERTION]: type is required
at validateOperation (/var/task/node_modules/elasticsearch-writable-stream/index.js:50:5)
at ElasticsearchWritable._write (/var/task/node_modules/elasticsearch-writable-stream/index.js:236:9)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at Transform.ondata (/var/task/node_modules/readable-stream/lib/_stream_readable.js:681:20)
at Transform.emit (node:events:517:28)
at Transform.emit (node:domain:489:12)
at addChunk (/var/task/node_modules/readable-stream/lib/_stream_readable.js:298:12)
at readableAddChunk (/var/task/node_modules/readable-stream/lib/_stream_readable.js:280:11) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}
This issue didn’t happen on OS 1.x