Groupby using Painless script - elasticsearch

I want to use the painless script to group the response received after running the index. I want to group the response based on the group_id tag and return other tags also. So far, I have used the following script:
{
"size": 0,
"_source": true,
"aggs": {
"entity_group_aggregations": {
"terms": {
"field": "group_id",
"order": {
"_term": "asc"
}
}
}
}
}
However, this script is not returning the desired output.
My index response looks like the following
{
"hits": {
"total": {
"value": 8693,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "entity_group",
"_type": "_doc",
"_id": "100000003628-brokerAssignment-Outbound-100000000483-aldera",
"_score": 1.0,
"_source": {
"interaction_id": 100000000483,
"group_id": "AFV0001789",
"dest_status": "success",
"group_effective_date": "2021-11-30T18:30:00.000Z",
"exception_cause": "",
"executed_dest_json": [
{
"Type": "Validation",
"name": "validateGroupCountry",
"group": "sequence2",
"sequence": 20,
"resultType": "success",
"status": "processed",
"description": "Validation for group country.",
"resultReason": "Success"
},
{
"Type": "Validation",
"name": "validateProductName",
"group": "sequence2",
"sequence": 21,
"resultType": "success",
"status": "processed",
"description": "Validation for product name.",
"resultReason": "Success"
},
{
"Type": "Validation",
"name": "validateProductEffectiveDate",
"group": "sequence2",
"sequence": 22,
"resultType": "success",
"status": "processed",
"description": "Validation for product effective date.",
"resultReason": "Success"
}
],
"file_name": "brokerAssignment",
"no_of_records": 3,
"di_source": "everwellNgl",
"group_name": "CLAXTON HOBBS PHARMACY - MPA7",
"src_status": "success",
"acknowlegment_record": "{\"groupReturn\": [{\"EB ID#\": \"3391F2D6-3035-11EC-B867-DA6E058A38F8\", \" Group Number\": \"dev-MPA7\", \"Dental Group Rating EE\": null, \"Vision Group Rating EE\": \"5.7\", \"Dental Group Rating FAM\": null, \"Everwell Dental Plan ID\": \"\", \"Everwell Vision Plan ID\": \"11964\", \"Vision Group Rating FAM\": \"16.66\", \" Dental Group Number\": \"\", \" Vision Group Number\": \"AFV0001789\", \"Dental Group Rating EE+CH\": null, \"Dental Group Rating EE+SP\": null, \"Vision Group Rating EE+CH\": \"11.96\", \"Vision Group Rating EE+SP\": \"11.4\", \"Dental Minimum Participation Met\": \"\", \"Vision Minimum Participation Met\": \"Y\"}]}",
"pre_br_canonical": {
"groupDetail": {
"contacts": [
{
"faxNumbers": [
{
"faxNumber": "7702272428",
"type": "primary"
}
],
"firstName": null,
"lastName": null,
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": "7702272428"
}
],
"emailAddresses": [
{
"emailAddress": null,
"type": "primary"
}
],
"type": "group"
},
{
"faxNumbers": [
{
"faxNumber": null,
"type": "primary"
}
],
"firstName": "billingfn",
"lastName": "billingln",
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": null
}
],
"emailAddresses": [
{
"emailAddress": "contaclmail5343234#gmail.com",
"type": "primary"
}
],
"type": "billing"
},
{
"faxNumbers": [
{
"faxNumber": null,
"type": "primary"
}
],
"firstName": "contactfn",
"lastName": "contactln",
"phoneNumbers": [
{
"extension": null,
"type": "primary",
"phoneNumber": null
}
],
"emailAddresses": [
{
"emailAddress": "akajjamiapin#empoweredbenefits.com",
"type": "primary"
}
],
"type": "admin"
}
],
"transactionType": "A",
"marketer": null,
"ein": null,
"products": [
{
"plans": [
{
"planTakeOverFlag": "N",
"paymentDetail": null,
"networkID": null,
"otherInsuranceCoverageId": null,
"terminationDate": "11-30-2022",
"rating": {
"financialCode": null,
"rateTimeBasis": null,
"rateEffectiveDate": null,
"rateTerminationDate": null,
"coverageTierCode": null,
"initialRateGuaranteePeriod": null,
"rateByCoverageCode": [
{
"maxAge": null,
"rateAmount": "5.7",
"coverageCode": "EMP",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "11.4",
"coverageCode": "ESP",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "11.96",
"coverageCode": "ECH",
"gender": null,
"minAge": null
},
{
"maxAge": null,
"rateAmount": "16.66",
"coverageCode": "FAM",
"gender": null,
"minAge": null
}
],
"initialRateGuaranteePeriodType": null,
"rateTableId": null
},
"effectiveDate": "12-01-2021",
"planId": null,
"minParMet": null,
"contract": null,
"planYearType": null,
"enrolledLives": 2,
"externalPlanId": "11964",
"eligibilityValidationCode": null
}
],
"renewalDate": null,
"renewalTimeValue": null,
"product": "VIS",
"terminationDate": null,
"effectiveDate": null,
"renewalTimeBasis": null
}
],
"websiteUrl": null,
"groupName": "HOBBS PHARMACY - MPA7",
"signingProducer": {
"lastName": "agentln",
"email": "agentmailfsd2345#gmail.com",
"firstName": "agentfn",
"writingNumber": "ad126"
},
"tin": "331057747",
"associatedBrokers": [
{
"brokerId": "A123",
"brokerLastName": "Kazhamiakin",
"systemLob": null,
"primaryAgent": null,
"brokerNpn": "15341",
"customLob": null,
"terminationDate": null,
"effectiveDate": "10-18-2021",
"brokerFirstName": "Alex",
"agency": {
"agencyName": null,
"agencyId": null,
"agreementType": null
},
"commissionDetail": {
"agentLevel": null,
"commission": null,
"commissionType": "2",
"commissionPlan": null
},
"splitPercentage": "100"
}
],
"source": "EverwellGroupsetup_20211108155000_Test1.csv",
"groupType": "NGL",
"division": null,
"sicCode": "5912",
"addresses": [
{
"line1": "131 W TAYLOR ST",
"zip": "30223",
"line2": null,
"city": "GRIFFIN",
"state": "GA",
"type": "group",
"country": "US"
},
{
"line1": null,
"zip": null,
"line2": null,
"city": null,
"state": null,
"type": "billing",
"country": "US"
}
],
"businessLevel": null
},
"groupIds": [
{
"system": "everwell",
"parentId": null,
"id": "3391F2D6-3035-11EC-B867-DA6E058A38F8"
},
{
"system": "",
"parentId": null,
"id": "dev-MPA7"
},
{
"system": "",
"parentId": null,
"id": null
}
],
"groupEligibilityDetail": {
"nextRenewalDate": "12-01-2022",
"terminationDate": null,
"groupStatus": null,
"effectiveDate": "12-01-2021",
"lastRenewalDate": null,
"eligibleLives": 9,
"terminationReason": null
},
"groupConfigurations": {
"billingConfiguration": {
"billingFrequency": "M",
"paymentType": null,
"billingParameters": [
{
"billCheckDigit": null,
"paymentType": null,
"applyAutoCash": null,
"terminationDate": null,
"effectiveDate": null,
"invoiceTimingType": null,
"invoiceBasisDateType": null,
"numberOfDaysPriorACH": null,
"invoiceType": null,
"billingParameterIds": [
{
"system": "aldera",
"parentId": null,
"id": null,
"previousId": null
}
]
}
]
},
"miscellaneousConfiguration": {
"preferredLanguage": null,
"orthoMaxInitialPaymentAmount": null,
"orthoInitialPayment": null,
"erApplicationPDFfileName": "71650_CLAXTON_HO.pdf",
"programNumber": null,
"orthoMaxAdditionalPaymentAmount": null,
"orthoPaymentType": null
},
"memberEligibilityConfiguration": {
"cobValidDays": null,
"memberVerificationFrequency": null,
"memberEligibilityFrequency": null,
"memberBenefitExtensionDays": null,
"idCardProductionParmeter": null,
"memberVerificationSource": null,
"waitingMonths": 1,
"memberEligibilityType": null,
"bigLoadAutoGenMemberID": null,
"coverageCodeCalculation": null
},
"groupEligibilityConfiguration": {
"renewalNotificationDays": null,
"memberEligibilityRequired": null,
"cascadeTermToMembers": null,
"retroNumberOfPeriods": null,
"fullTimeEligibilityHours": 11,
"runOutDays": null,
"retroTimePeriodType": null,
"cascadeTermToSubGroups": null
},
"ratingConfiguration": {
"financialCode": null,
"rateTimeBasis": null,
"renewalTimeValue": null,
"rateTableDescription": null,
"genderRated": null,
"coverageTierId": null,
"renewalTimeBasis": null,
"rateTableId": null
}
}
},
"source_status": "warning",
"#version": "1",
"state": "processed",
"source_interaction_type": "sftp",
"processed_date": "2021-12-27T13:48:08.000Z",
"destination_response_result": null,
"exception_cause_source": "",
"destination": "aldera",
"file_interaction_type": "Outbound",
"dest_transaction_id": 3383,
"product": "vision",
"process": "Group",
"initialized_time": "2021-12-27T13:56:44.000Z",
"minparmet": "1",
"received_date": "2021-12-26T18:30:00.000Z",
"group_state": "GA",
"transaction_type": "add",
"destination_response_record": null,
"latest_transaction_date": "2021-12-27T13:48:08.000Z",
"source_file_id": 853,
"record_id": 100000003628,
"status": "success",
"#timestamp": "2022-08-05T10:23:49.002Z",
}
}
]
}
}

Related

Elastic search query - all objects of nested array should have specific value

I want to write Elasticsearch query where I am able to look into a nested array, and check a key for all those elements inside the array, if all of them have that value then the root document should be selected.
this is a sample data :
[
{
"_index": "allproperties",
"_type": "_doc",
"_id": "5241050",
"_score": 0.0,
"_source": {
"id": 5241050,
"type": "HOUSE",
"state": "NSW",
"agency": {
"id": 31,
"code": "AU_LNT",
"name": "Luthor Properties",
"config": "{}"
},
"branch": {
"id": 89,
"name": "Luthor Sales Unit Trust",
"tradingName": "Luthor Properties",
"internalCode": "AU_LNT_G"
},
"images": null,
"leases": [
{
"id": 26439,
"bond": 2000,
"leased": true,
"source": "PORTAL",
"status": "SIGNED",
"endDate": "2022-11-06T00:00:00",
"tenants": [
{
"id": 11106,
"role": "TENANT",
"user": {
"id": 38817,
"dob": "1900-01-01",
"name": "Liam",
"email": "tempo#tempo.com",
"phone": "+61400000000",
"surname": "Tempo",
"salutation": "Mr.",
"invitations": null,
"lastInAppActivity": null
},
"address": "45675 Bruce Hwy, Coolbie QLD 4850, Australia",
"extendedData": "{\"rentSplitAmount\":22.62}",
"roleAdjective": "PRIMARY",
"addressComponents": {
"state": "QLD",
"suburb": "Coolbie",
"country": "Australia",
"postcode": "4850",
"streetName": "Bruce Hwy",
"unitNumber": null,
"poboxNumber": null,
"streetNumber": "45675",
"addressComponentsUnavailable": null
}
}
],
"signDate": "2022-10-05T04:58:08.887",
"startDate": "2022-10-06T00:00:00",
"moveInDate": "2022-10-06T00:00:00",
"appointments": [
{
"id": 3506,
"type": "REMOTE",
"date_time": "2022-10-12T04:56:00+00:00",
"createdBy": "Lex Luthor",
"createdDate": "2022-10-05T04:56:52.936",
"lastModifiedBy": "Lex Luthor",
"lastModifiedDate": "2022-10-05T04:56:53.51"
}
],
"createdDate": "2022-10-05T04:55:42.247",
"rentalAmount": 500,
"dateAvailable": null,
"extendedData": {
"last_rent_adjustment_date": 1665014400000
},
"leaseDuration": 32,
"rentalFrequency": "2",
"signedManually": false
}
],
"refId": "b66326eb-a6b2-42b6-b058-b46847e13399",
"source": "PT",
"status": null,
"suburb": "Hurstville",
"address": "456 Forest Road Hurstville NSW AUSTRALIA 2220",
"country": "Australia",
"bedrooms": 3,
"category": null,
"pmsCode": "84c34d15-a0ab-4791-b9e3-1bdac215b99c",
"postcode": "2220",
"agencyId": 31,
"bathrooms": 3,
"branchId": 89,
"carspaces": 3,
"createdBy": "system",
"streetname": "Forest Road",
"unitnumber": null,
"description": null,
"createdDate": "2022-10-05T04:51:12.619",
"entitlements": [
{
"id": 3453799,
"role": "LANDLORD",
"user": {
"id": 22855,
"dob": null,
"name": "please enter ownership name",
"email": "mag.m#rr.com.au",
"phone": "0400000000",
"surname": "",
"salutation": null,
"lastInAppActivity": null
},
"company": {
"id": 137,
"abn": "",
"acn": "",
"phone": "0400000000",
"address": "1234 Park Avenue New York NY USA 10037-1702",
"companyName": "please enter ownership name",
"displayName": "please enter ownership name",
"email": "mag.m#rr.com.au"
},
"roleAdjective": "GROUP"
},
{
"id": 3453800,
"role": "AGENT",
"user": {
"id": 20054,
"dob": null,
"name": "Paul",
"email": "p.b#mr.com",
"phone": "+61403084232",
"surname": "Botti",
"salutation": null,
"lastInAppActivity": null
},
"company": null,
"roleAdjective": "MANAGING"
},
{
"id": 3453801,
"role": "AGENT",
"user": {
"id": 20054,
"dob": null,
"name": "Paul",
"email": "p.b#mr.com",
"phone": "+61403084232",
"surname": "Botti",
"salutation": null,
"lastInAppActivity": null
},
"company": null,
"roleAdjective": "LEASING"
}
],
"streetnumber": "456",
"advertised": false,
"commission_type": null,
"lastModifiedBy": "system",
"lastModifiedDate": "2022-10-05T04:58:09.043",
"_meta": {
"branches": {
"id": [
89
]
},
"agencies": {
"id": [
31
]
},
"user_property_entitlement": {
"id": [
3453799,
3453800,
3453801
]
},
"users": {
"id": [
20054,
22855,
38817
]
},
"companies": {
"id": [
137
]
},
"leases": {
"id": [
26439
]
},
"user_lease_entitlement": {
"id": [
11106
]
},
"appointments": {
"id": [
3506
]
}
}
},
"sort": [
1664945472619,
0.0
]
}
]
In this particular case, leases is a nested document, I want to select the documents where all the leases are in cancelled state or leases is null, i.e; either all of the objects inside leases should have status as CANCELLED or the leases key should be null.
Already went through this question, but did'nt quite get it as its an old answer from 2015 and methods used in this got deprecated.
Try this query:
GET idx_test/_search?filter_path=hits.hits
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "leases",
"query": {
"bool": {
"must_not": [
{
"bool": {
"should": [
{
"term": {
"leases.status.keyword": "CANCELLED"
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "leases"
}
}
]
}
}
]
}
}
]
}
}
}
}
]
}
}
}

JSONPath | JMeter | Condition fetch

Using JSONPath I'm trying to fetch channels > "id": "6af38171-867c-414f-a128-6668fc66cd20" based on provided productId from different request
Example 1: for "productId": "3211a29f0c3-9180-4cd7-a5c7-282f6689c31a", channel id should be "id": "29b13081-760a-4451-81d8-25f0944b3658",
Example 2: for "productId": "321557a97a5-ef93-46b7-868c-4f26439fbcb9", channel id should be "id": "6af38171-867c-414f-a128-6668fc66cd20",
Example 3: for "productId": "321ecc29f29-bc03-41d7-b107-db3be8103216", channel id should be "id": "293e31b4-8ebb-40af-8015-44b1a37ba84f",
productId picked randomly from the previous request
$..[?(#.promotionRule.promotionProducts[0].productId=="ecc29f29-bc03-41d7-b107-db3be8103216" )].id which is coming as paramter $..[?(#.promotionRule.promotionProducts[0].productId=="${je_productId}" )].id
Payload
{
"error": null,
"data": [
{
"id": "c0c18687-26cc-48da-b60a-d386279d1c3e",
"channels": [
{
"id": "29b13081-760a-4451-81d8-25f0944b3658",
"promotionRule": {
"id": "18f84232-7350-4f9f-8037-7e92eebbc4d4",
"promotionProducts": [
{
"id": "2d755bfe-8b8f-4b2a-9bf4-e8e626975b51",
"productId": "3211a29f0c3-9180-4cd7-a5c7-282f6689c31a",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "8291365c-df9f-4d7b-8f34-be0b500065ee",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:37:15.5161071+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:37:15.5152919+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T18:37:15.5168274+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": null,
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "100%",
"channelGroupLogo": "https://123/media/100percentlogo.png",
"channelGroupLogoHD": "https://123/media/100percentlogo.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
},
{
"id": "e2de2a1f-a21b-41db-82c0-a5710cf59dee",
"channels": [
{
"id": "6af38171-867c-414f-a128-6668fc66cd20",
"promotionRule": {
"id": "074eced6-9894-4313-85e2-2a04965fc8eb",
"promotionProducts": [
{
"id": "b93ccce2-171b-4e4e-83d7-fd77632acb4f",
"productId": "321557a97a5-ef93-46b7-868c-4f26439fbcb9",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "a3d14456-64cb-4cae-b749-133c4b6a476a",
"options": null
},
{
"description": "Play Type",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "d50aeef2-4821-4247-b712-585a2ba55f81",
"options": null
},
{
"description": "Front Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "ed6a4930-2558-414d-b47f-a3f95e719f60",
"options": null
},
{
"description": "Middle Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e0957685-22d8-4827-a3db-a1e2e0b5b76b",
"options": null
},
{
"description": "Back Number",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "98b3c77a-bb25-4a45-a2ca-c90a79c75ecb",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T20:17:01.7837463+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T20:17:01.7829809+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T20:17:01.7844511+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": "https://123/cdn/BahamasTourismBoard.png",
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "Pick 3",
"channelGroupLogo": "https://123/brandmedia/AcmePick3.png",
"channelGroupLogoHD": "https://123/brandmedia/AcmePick3.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
},
{
"id": "b234c6b1-ffba-4883-ae9a-d6483b4787ab",
"channels": [
{
"id": "293e31b4-8ebb-40af-8015-44b1a37ba84f",
"promotionRule": {
"id": "863b5465-d5ab-4433-bea2-2b0d4da0cfcc",
"promotionProducts": [
{
"id": "c5031107-3995-48d0-8f26-95597531e7e4",
"productId": "321ecc29f29-bc03-41d7-b107-db3be8103216",
"instanceCountMin": 0,
"instanceCountMax": 0,
"promotionProductRules": [
{
"componentConstraints": [
{
"description": "Panel Amount",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 2,
"componentId": "db7ae266-bf79-4d63-984a-aea1aa7af460",
"options": null
},
{
"description": "White Ball - 1",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "8b750179-6ead-425e-b5a2-ab422e72a03e",
"options": null
},
{
"description": "White Ball - 2",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "3a87a9aa-d8c8-465a-ae35-f7d894204b13",
"options": null
},
{
"description": "White Ball - 3",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "6b674bc4-1143-4558-8020-88872064b6d2",
"options": null
},
{
"description": "White Ball - 4",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "0cf02fdf-c717-4ea0-a230-cb837792e7f5",
"options": null
},
{
"description": "White Ball - 5",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e627485b-eb3b-4afe-a20d-bed5c30ba195",
"options": null
},
{
"description": "Powerball",
"extensions": null,
"amountOfAdjustment": 0.0,
"componentConsumerSelectionType": 1,
"componentId": "e4c6e609-954a-4707-88b5-c47993fb3f82",
"options": null
}
],
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:44:42.9594038+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
}
]
}
],
"maxDistributionCount": null,
"selectablePromotionsMin": 1,
"selectablePromotionsMax": 1,
"canBeCombined": false,
"priority": 0,
"promotionRecurrence": null,
"extensions": {},
"externalId": null,
"sponsorshipAppliesToEntities": [],
"createdOn": "2022-03-25T18:44:42.9586017+00:00",
"updatedOn": null,
"deletedOn": null,
"releaseOn": "2022-03-25T18:44:42.9601687+00:00",
"expireOn": null,
"expiredOn": null,
"currency": "USD",
"ruleDescription": null,
"ruleName": null,
"simulationTypes": 0,
"value": 0.0
},
"authorityName": null,
"currency": "USD",
"channelName": "The Islands of The Bahamas",
"channelLogo": "https://123/cdn/BahamasTourismBoard.png",
"channelLogoHD": "https://123/cdn/BahamasTourismBoard.png",
"channelAnimated": null,
"channelAnimatedHD": null,
"sortOrder": 0,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
],
"priority": 0,
"brandName": null,
"channelGroupName": "Powerball",
"channelGroupLogo": "https://123/brandmedia/PowerballLogo.png",
"channelGroupLogoHD": "https://123/brandmedia/PowerballLogo.png",
"channelGroupAnimated": null,
"channelGroupAnimatedHD": null,
"releaseOn": null,
"expireOn": null,
"expiredOn": null,
"suspendedOn": null,
"suspendedBy": null
}
]
}
"Your" $..[?(#.promotionRule.promotionProducts[0].productId=="ecc29f29-bc03-41d7-b107-db3be8103216" )].id expression works fine for me (given I add 321 to the beginning to match response data
If it doesn't work for you - check the ${je_productId} JMeter Variable value using Debug Sampler and View Results Tree listener combination
Also be aware that JMeter Variables are not being evaluated in the "JSON Path Tester" mode of the View Results Tree listener mainly because they don't exist there.

ElasticSearch: "Object field starting or ending with a [.] makes object resolution ambiguous: []"

I'm getting the error "object field starting or ending with a [.] makes object resolution ambiguous: []". But there isn't a single dot [.] in my object. Using elasticClient.update() I'm passing:
{
"index": "applicants",
"type": "applicant",
"id": "A01gfGEBKfWmu0nhvuR7",
"body": {
"doc": {
"phsEmploymentHistory": {
"numSickDaysNotIll": "4",
"employers": [{
"employmentType": {},
"": {},
"name": null,
"supervisor": null,
"contactNumber": null,
"extension": null,
"email": null,
"coworker1": null,
"coworker2": null,
"duties": null,
"jobTitle": null,
"reasonLeaving": null,
"fullTime": null,
"partTime": null,
"temp": null,
"selfEmployed": null,
"volunteer": null,
"duration": {
"startDate": null,
"endDate": null
},
"address": {
"street": null,
"city": null,
"state": null,
"zip": null
}
}],
"agencies": [{
"": {},
"agencyName": null,
"backgroundInvestigator": null,
"contactNumber": null,
"extension": null,
"position": null,
"email": null,
"stepsCompleted": null,
"dateApplied": null,
"status": null,
"address": {
"street": null,
"city": null,
"state": null,
"zip": null
}
}],
"disciplined": {
"response": false,
"explanation": ""
},
"warnedDrugs": {
"response": false,
"explanation": ""
},
"valid": true
}
}
}
}
I've been over this several times. I don't think the error message is adequate. The "object resolution ambiguous: []" seems to hint that I have an empty array, but I don't.
Values of the json could be empty. But if the keys are empty then ES throws error while indexing.
Remove "":{} from the json and index again.
Reference:
https://discuss.elastic.co/t/object-field-starting-or-ending-with-a-makes-object-resolution-ambiguous/123351

Decimal error in brain tree dashboard

When I am making transaction through braintree payment gateway I get the response which I have attached below the amount returned is 1200 but in the braintree dashboard I get 1.200 (decimal).
"PAYMENT": {
"transaction": {
"id": "dhsaj2vy",
"status": "submitted_for_settlement",
"type": "sale",
"currencyIsoCode": "EUR",
"amount": "1200.00",
"merchantAccountId": "5646466767909",
"subMerchantAccountId": null,
"masterMerchantAccountId": null,
"orderId": null,
"createdAt": "2017-08-19T13:05:47Z",
"updatedAt": "2017-08-19T13:05:47Z",
"customer": {
"id": "8239041739880",
"firstName": "a#g.com",
"lastName": "",
"company": null,
"email": null,
"website": null,
"phone": null,
"fax": null
},
"billing": {
"id": "ff",
"firstName": null,
"lastName": null,
"company": null,
"streetAddress": null,
"extendedAddress": null,
"locality": null,
"region": null,
"postalCode": "5328",
"countryName": null,
"countryCodeAlpha2": null,
"countryCodeAlpha3": null,
"countryCodeNumeric": null
},
"refundId": null,
"refundIds": [],
"refundedTransactionId": null,
"partialSettlementTransactionIds": [],
"authorizedTransactionId": null,
"settlementBatchId": null,
"shipping": {
"id": null,
"firstName": null,
"lastName": null,
"company": null,
"streetAddress": null,
"extendedAddress": null,
"locality": null,
"region": null,
"postalCode": null,
"countryName": null,
"countryCodeAlpha2": null,
"countryCodeAlpha3": null,
"countryCodeNumeric": null
},
"customFields": "",
"avsErrorResponseCode": null,
"avsPostalCodeResponseCode": "M",
"avsStreetAddressResponseCode": "I",
"cvvResponseCode": "I",
"gatewayRejectionReason": null,
"processorAuthorizationCode": "F6D7CV",
"processorResponseCode": "1000",
"processorResponseText": "Approved",
"additionalProcessorResponse": null,
"voiceReferralNumber": null,
"purchaseOrderNumber": null,
"taxAmount": null,
"taxExempt": false,
"creditCard": {
"token": "6wh2v4",
"bin": "555555",
"last4": "4444",
"cardType": "MasterCard",
"expirationMonth": "12",
"expirationYear": "2025",
"customerLocation": "US",
"cardholderName": null,
"imageUrl": "https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=sandbox",
"prepaid": "Unknown",
"healthcare": "Unknown",
"debit": "Unknown",
"durbinRegulated": "Unknown",
"commercial": "Unknown",
"payroll": "Unknown",
"issuingBank": "Unknown",
"countryOfIssuance": "Unknown",
"productId": "Unknown",
"uniqueNumberIdentifier": "4522ba536b44dec3d9d7a7cc3b059d1e",
"venmoSdk": false,
"maskedNumber": "555555******4444",
"expirationDate": "12/2025"
},
"statusHistory": [{
"timestamp": "2017-08-19T13:05:47Z",
"status": "authorized",
"amount": "12011.00",
"user": "g5bareja#gmail.com",
"transactionSource": "api"
}, {
"timestamp": "2017-08-19T13:05:47Z",
"status": "submitted_for_settlement",
"amount": "1200.00",
"user": "g5bareja#gmail.com",
"transactionSource": "api"
}],
"planId": null,
"subscriptionId": null,
"subscription": {
"billingPeriodEndDate": null,
"billingPeriodStartDate": null
},
"addOns": [],
"discounts": [],
"descriptor": {
"name": null,
"phone": null,
"url": null
},
"recurring": false,
"channel": null,
"serviceFeeAmount": null,
"escrowStatus": null,
"disbursementDetails": {
"disbursementDate": null,
"settlementAmount": null,
"settlementCurrencyIsoCode": null,
"settlementCurrencyExchangeRate": null,
"fundsHeld": null,
"success": null
},
"disputes": [],
"authorizationAdjustments": [],
"paymentInstrumentType": "credit_card",
"processorSettlementResponseCode": "",
"processorSettlementResponseText": "",
"threeDSecureInfo": null,
"paypalAccount": {},
"coinbaseAccount": {},
"applePayCard": {}
},
But in dashboard I see 1.200 why is there error in decimal points when braintree is returning me the correct amount?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
What you see in your Dashboard is the correct format of Euro currency denoting the value one thousand two hundred.
A quick search for proper formatting of Euro currency shows that the decimal separator is a "," and the thousands separator is a ".". Here's an example contrasting EUR and USD:
EUR 1.200,00
USD 1,200.00
Braintree adheres to the standard format of the currencies it supports.

Queries on ElasticSearch

I have a document which look like this,
{
"_index": "w3-commsvc",
"_type": "message",
"_id": "h98yv662",
"_score": 1,
"_source": {
"messageId": "h98yv662",
"campaignName": "src_checkoutAbandon",
"campaignId": "cId_w3_website",
"states": [
{
"Delivered": 790709218
},
{
"open": 1288775055
},
{
"click": 319518555
},
{
"DEFERRED": 2137606534
}
],
"clientName": "w3_website",
"templateId": "test",
"opens": [
{
"url": "www.something.com",
"id": "t26jj783",
"userAgent": {
"browser": {
"family": "IE",
"version": "11.0",
"major": "11",
"minor": "0",
"patch": null
},
"os": {
"family": "Windows_XP",
"version": null,
"versionPopularName": null,
"major": null,
"minor": null,
"patch": null,
"patchMinor": null
},
"device": {
"family": "Other",
"type": "Computer"
}
},
"timestamp": "1372366437"
},
{
"url": "www.something.com",
"id": "t98ef285",
"userAgent": {
"browser": {
"family": "IE",
"version": "11.0",
"major": "11",
"minor": "0",
"patch": null
},
"os": {
"family": "Windows_XP",
"version": null,
"versionPopularName": null,
"major": null,
"minor": null,
"patch": null,
"patchMinor": null
},
"device": {
"family": "Other",
"type": "Computer"
}
},
"timestamp": "717918284"
}
],
"clicks": [
{
"url": "www.something.com",
"id": " j60te707",
"userAgent": {
"browser": {
"family": "IE",
"version": "11.0",
"major": "11",
"minor": "0",
"patch": null
},
"os": {
"family": "Windows_XP",
"version": null,
"versionPopularName": null,
"major": null,
"minor": null,
"patch": null,
"patchMinor": null
},
"device": {
"family": "Other",
"type": "Computer"
}
},
"timestamp": "1293320728"
},
{
"url": "www.something.com",
"id": " c63bc623",
"userAgent": {
"browser": {
"family": "IE",
"version": "11.0",
"major": "11",
"minor": "0",
"patch": null
},
"os": {
"family": "Windows_XP",
"version": null,
"versionPopularName": null,
"major": null,
"minor": null,
"patch": null,
"patchMinor": null
},
"device": {
"family": "Other",
"type": "Computer"
}
},
"timestamp": "624917313"
},
{
"url": "www.something.com",
"id": " f10qm",
"userAgent": {
"browser": {
"family": "Firefox",
"version": "11.0",
"major": "11",
"minor": "0",
"patch": null
},
"os": {
"family": "Windows_XP",
"version": null,
"versionPopularName": null,
"major": null,
"minor": null,
"patch": null,
"patchMinor": null
},
"device": {
"family": "Other",
"type": "Computer"
}
},
"timestamp": "334734507"
}
]
}
}
Now using the above documents i need the following answer for the following queries,
1 - I need the terms count of each state for a certain clientName.
2 - Total sum of length of each opens array in the document.
3 - Open and click stats for each browsers.

Resources