Skip to content

Commit

Permalink
RA-25033: Added Index type field mapping to identify ridedetails and …
Browse files Browse the repository at this point in the history
…audit logs
  • Loading branch information
shubhisood committed Aug 12, 2020
1 parent e58feba commit 03b55c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions reindexAuditLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ async function bulkIndexAuditLogs(rideId, auditLogs, rideRange) {
_id: value._id,
},
});
elindex.push(value._source);
const source = {...value._source, index_type: 'audit_log' }
elindex.push(source);
});
try {
await callBulkAPI(elindex);
Expand Down Expand Up @@ -98,7 +99,7 @@ async function createIndex(indexName, fromIndex) {
const result = await elasticClient.indices.getMapping({ index: fromIndex });
const { mappings } = result[fromIndex];
const properties = {};
properties.type = { type: 'keyword' };
properties.index_type = { type: 'keyword' };
Object.entries(mappings).forEach(([key, value]) => {
if (value.properties) {
Object.entries(value.properties).forEach(([propKey, propValue]) => {
Expand Down

0 comments on commit 03b55c4

Please sign in to comment.