From 64bc0c3fdf83bf7aef96b057c96c85b7264e1b03 Mon Sep 17 00:00:00 2001 From: Naresh Singh Date: Tue, 27 Oct 2020 18:27:25 +0530 Subject: [PATCH] RA-26080 remove properties --- newReindexAuditLogs.js | 2 -- newUtils.js | 25 +++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/newReindexAuditLogs.js b/newReindexAuditLogs.js index c1fb5a2..aa92be7 100644 --- a/newReindexAuditLogs.js +++ b/newReindexAuditLogs.js @@ -21,8 +21,6 @@ async function callBulkAPI(elindex) { async function bulkIndexAuditLogs(rideId, auditLogs, rideRange) { const elindex = []; auditLogs.forEach((value) => { - utils.filterObject(value, 'legToFlatFeeMapping '); - utils.filterObject(value, 'changed_legs'); elindex.push({ index: { diff --git a/newUtils.js b/newUtils.js index 46d1382..c80d878 100644 --- a/newUtils.js +++ b/newUtils.js @@ -72,8 +72,7 @@ const createIndex = async function createIndex(indexName, fromIndex) { } }); - filterObject(properties, 'legToFlatFeeMapping'); - filterObject(properties, 'changed_legs'); + removeProperty(properties); await elasticClient.indices.putMapping({ index: indexName, type: 'doc', body: { properties, dynamic: false }, @@ -127,6 +126,8 @@ const createLogstashIndex = async function createLogstashIndex(indexName, fromIn }); } }); + + removeProperty(properties); await elasticClient.indices.putMapping({ index: indexName, type: 'doc', body: { properties, dynamic: false }, }); @@ -153,6 +154,26 @@ function filterObject(obj, key) { filterObject(obj[i], key); } } + +} + + +function removeProperty(obj){ + if(obj?.meta?.data?.vendor_lists?.latest_flat_rate?.legToFlatFeeMapping){ + delete obj.meta.data.vendor_lists.latest_flat_rate.legToFlatFeeMapping + } + + if(obj?.meta?.data?.orderUpdateDiff?.changed_legs){ + delete obj.meta.data.orderUpdateDiff.changed_legs + } + + if(obj?.meta?.billingWriteBack?.legs?.fare_breakdown){ + delete obj.meta.billingWriteBack.legs.fare_breakdown + } + + if(obj?.receipt?.fare_breakdown){ + delete obj.receipt.fare_breakdown + } } module.exports = {createIndex, createLogstashIndex, filterObject}; \ No newline at end of file