Hi Ryan,
Thanks so much for the response. Let me see if i Understand you correctly.
When you say "each Element of the products array" does that mean each key value pair in the nested products array is a separate document?
This is what my mapping looks like.
{
"mappings": {
"couchbaseDocument": {
"dynamic_templates": [
{
"date_as_string": {
"match_mapping_type": "date",
"match_pattern": "regex",
"match": "^(holdDate|startDate|endDate)$",
"mapping": {
"type": "text",
"fields": {
"type": "keyword",
"ignore_above": 256
}
}
}
},
{
"ignore": {
"match_pattern": "regex",
"match": "^(esQuery|aliasDict|gwData|orderData|firstOrderData|trackData|firstTrackData|dashboardData|jwts|permissions|error|credentials|interval|clvByAffiliate|clvByCountry|clvDistribution|filters)$",
"mapping": {
"enabled": false
}
}
}
],
"properties": {
"doc": {
"properties": {
"products": {
"properties": {
"recurringDate": {
"type": "text",
"fields": {
"date": {
"type": "date",
"format": "yyyy-MM-dd",
"ignore_malformed": true
},
"keyword": {
"type": "keyword"
}
}
}
}
},
"action": {
"type": "nested",
"dynamic": true
},
"externalId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"recurringDate": {
"type": "text",
"fields": {
"date": {
"type": "date",
"format": "yyyy-MM-dd",
"ignore_malformed": true
},
"keyword": {
"type": "keyword"
}
}
},
"chargebackDate": {
"type": "text",
"fields": {
"date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true
},
"keyword": {
"type": "keyword"
}
}
},
"acquisitionDate": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true,
"fields": {
"text": {
"type": "text"
},
"keyword": {
"type": "keyword"
}
}
},
"timeStamp": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss",
"ignore_malformed": true,
"fields": {
"text": {
"type": "text"
},
"keyword": {
"type": "keyword"
}
}
},
"date": {
"type": "date",
"format": "epoch_millis",
"ignore_malformed": true,
"fields": {
"text": {
"type": "text"
},
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}
},
"settings": {
"index.mapping.total_fields.limit": 10000
}
}
This is what my 'order' Document, which contains the nested product array looks like. Some value omitted for privacy and char limit per reply .
{
"_index": "ban.....",
"_type": "doc",
"_id": "Order|05dfcb133189ba801ba5663be46c665badd009810195160419e2462d8b26ce06",
"_score": 1,
"_source": {
"meta": {
"vbuuid": 126392786703854,
"rev": "4-15c5065849d800000000000002000000",
"seqno": 1179,
"cas": 1568667021474267100,
"revSeqno": 4,
"lockTime": 0,
"flags": 33554432,
"vbucket": 840,
"expiration": 0,
"id": "Order|05dfcb133189ba801ba5663be46c665badd009810195160419e2462d8b26ce06"
},
"doc": {
"_type": "Order",
"createdDate": "2019-09-05T20:52:35.872Z",
"externalId": "523...",
"lastUpdate": "2019-09-16T20:50:20.569Z",
"relatedId": "352...",
"acquisitionDate": "2019-07-06 11:39:26",
"affid": "OA",
"affiliate": "OA",
"ancestorId": "35....",
"billingAddressId": "44170d22a65fd0005f9330eff9c1d477afc6d53f24f1d850c4f52417032e08f1",
"billingCycle": "1",
"billingFirstName": "cl....",
"billingLastName": "mo.....",
"chargebackDate": "",
"customerId": "df232f3a70b4dd0fbb20bfd5fe55cf5482d5bbf99cf36017e83a5aa8cb5806be",
"customersTelephone": "617...",
"declineReason": "DO NOT RETRY - Bank decline",
"declineSalvageDiscountPercent": "0",
"emailAddress": "chm...",
"externalCustomerId": "456..",
"gatewayDescriptor": "mect...",
"gatewayId": "198",
"ipAddress": "108.74.30.252",
"isBlacklisted": "0",
"isChargeback": "0",
"parentId": "352593",
"recurringDate": "2019-10-05",
"gift": {},
"products": [
{
"productId": "0e4f3e5398cc97b572c853cedac98671dcfa70cd349bbc8067ffb83f35d2645d",
"quantity": "1",
"isRecurring": "0",
"recurringDate": "2019-10-05",
"subscriptionId": "0c72a08ec378a861cf5d51f536a021bd",
"isShippable": "1",
"isFullRefund": "0",
"refundAmount": "0.00",
"onHold": "0"
}
],
"Notes": {
"systemNotes": [
"September 05, 2019 03:00 PM - ...",
"September 05, 2019 03:00 PM - ..."
]
},
"sourceId": "6f46986c-85ba-4207-9d16-c61fff638f0e",
"clientId": "02d41dbf-bec2-4ee9-b6fa-dc87560f8dc4",
"orderId": "05dfcb133189ba801ba5663be46c665badd009810195160419e2462d8b26ce06",
"date": 1567695611000,
"isInitial": false
}
}
}