setting = Subject.objects.annotate(A_setup=Count('id', filter=Q(type='A'), distinct=True) * Value(50),
B_setup=Count('id', filter=Q(type='B'), distinct=True) * Value(30),
C_setup=Count('id', filter=(~Q(type='A') & ~Q(type='B') & ~Q(type__isnull=True) & Q(id__in=workers.filter(worker=1).values('id')))) * Value(10)) \
.values('setting__user_id', 'A_setup', 'B_setup', 'C_setup')
setting = [{'setting__user_id': 4, 'A_setting': 50.0, 'B_setting': 120, 'C_setting': 10.0}, {'setting__user_id': 34, 'A_setting': 0.0, 'B_setting': 0, 'C_setting': 0.0}, {'setting__user_id': 33, 'A_setting': 0.0, 'B_setting': 150, 'C_setting': 0.0}, {'setting__user_id': 30, 'A_setting': 0.0, 'B_setting': 150, 'C_setting': 0.0}, {'setting__user_id': 74, 'A_setting': 50.0, 'B_setting': 120, 'C_setting': 10.0}]
uploader = Feedback.objects .values('uploader_id').distinct().values_list('uploader_id')
uploader = [{'uploader_id': 25}, {'uploader_id': 20}, {'uploader_id': 74}, {'uploader_id': 34}, {'uploader_id': 93}, {'uploader_id': 88}, {'uploader_id': 73}, {'uploader_id': 89}, {'uploader_id': 30}, {'uploader_id': 33}, {'uploader_id': 85}, {'uploader_id': 4}, {'uploader_id': 46}]
"setting" outputs only users who satisfy the conditions. But I need a list of all users. The "uploader" is a queryset containing all users. First, the entire list of users is printed, and if the user's id is included in the "setting", the setting value is output. The final result I want to achieve is as follows.
Desired Result: [['25', '0', '0', '0'], ['20', '0', '0', '0'], ['74', '50', '120', '10'], ['34', '0', '0', '0'], ['93', '0', '0', '0'], ['88', '0', '0', '0'], ['73', '0', '0', '0'], ['89', '0', '0', '0'], ['30', '0', '150', '0'], ['33', '0', '150', '0'], ['35', '0', '0', '0'], ['4', '50', '120', '10'], ['46', '0', '0', '0']]
sorry. Please check again. There are two querysets. I want to get the A_setup, B_setup, C_setup values of setting if uploader id and uploader id of setting are the same after unfolding the uploader queryset, and adding 0 if there is no uploader id in setting.
How do I get the results I want?
In my opinion, it is better to change the data structure a little bit (into setting_new and uploader_ids below), and then use list comprehension:
from operator import itemgetter
# setting = [{'setting__user_id': 4, 'A_setting': 50.0, 'B_setting': 120, 'C_setting': 10.0}, ...
# uploader = [{'uploader_id': 25}, {'uploader_id': 20}, {'uploader_id': 74}, ...
setting_new = {dct['setting__user_id']: itemgetter('A_setting', 'B_setting', 'C_setting')(dct) for dct in setting}
uploader_ids = map(itemgetter('uploader_id'), uploader)
output = [[i, *setting_new.get(i, (0,0,0))] for i in uploader_ids]
print(output)
# [[25, 0, 0, 0], [20, 0, 0, 0], [74, 50.0, 120, 10.0], [34, 0.0, 0, 0.0], ...
How to convert below orderedict into regular json ? in python?
[OrderedDict([('ins_short_name', 'MI'), ('beneficiary', []),
('benefit', 65), ('pcp', []), ('benefit_rates', 216),
('added_dependent', []), ('removed_dependent', []), ('ins_name',
'Medical Insurance'), ('plan', {'carrier_logo':
'How to create a DateTime equal to 15 minutes ago?',
'plan_type': 'HMO', 'creation_time': '2019-02-11T06:21:21.743369Z',
'plan_info_details': '', 'rx_coverage': '11', 'id': 65, 'co_pay':
'11', 'contribution_interval': None, 'updation_time':
'2019-02-11T06:21:21.743808Z', 'benefit_display_name': 'Mi1 HMO',
'carrier': 1, 'status': False, 'carrier_name': 'NHP',
'rx_information': None, 'voluntary': False, 'deductible': '11`',
'hsa_qualified_wrap_plan': False, 'benefit': 65,
'terms_and_conditions': None, 'maximum_contribution': None,
'hsa_qualified_base_plan': False, 'primary_care_physician': False,
'plan_info': ''}), ('dependent', []), ('questions',
[OrderedDict([('question', 1), ('question_type', 'radio'),
('identifier', 'Q1'), ('ref', [Decimal('1.00')])]),
OrderedDict([('question', 4), ('question_type', 'plan'),
('identifier', 'Q4'), ('ref', [Decimal('216.00')])])])]),
OrderedDict([('ins_short_name', 'AI'), ('beneficiary',
[OrderedDict([('id', 365), ('first_name', 'rer'), ('last_name',
'ere'), ('relation', 'Spouse'), ('other_relation', None), ('_type',
'Primary'), ('percentage', '100'), ('benefit', 66), ('enrollment',
357), ('creation_time', '2019-02-14T12:04:00.676078Z'),
('updation_time', '2019-02-14T12:04:33.475164Z')])]), ('benefit', 66),
('pcp', []), ('benefit_rates', None), ('added_dependent', []),
('removed_dependent', []), ('ins_name', 'Ancillary Insurance'),
('plan', {'carrier_logo':
'How to create a DateTime equal to 15 minutes ago?',
'plan_type': 'Other', 'creation_time': '2019-02-11T06:24:32.322178Z',
'plan_info_details': '', 'rx_coverage': '', 'id': 66, 'co_pay': '',
'contribution_interval': None, 'updation_time':
'2019-02-11T06:24:32.322541Z', 'benefit_display_name': 'Ai name',
'carrier': 1, 'status': False, 'carrier_name': 'NHP',
'rx_information': None, 'voluntary': True, 'deductible': '',
'hsa_qualified_wrap_plan': False, 'benefit': 66,
'terms_and_conditions': None, 'maximum_contribution': None,
'hsa_qualified_base_plan': False, 'primary_care_physician': False,
'plan_info': ''}), ('dependent', []), ('questions',
[OrderedDict([('question', 12), ('question_type', 'radio'),
('identifier', 'Q12'), ('ref', [Decimal('10.00')])])])])]
I have some data in a dictionary. The sample of data is as shown below. when I tried to insert this data of dictionary to elasticsearch. It returns me the error. what I am doing wrong
doc={
'pdpData.addDate': 1453718315L,
'pdpData.ageGroup': 'Adults-Women',
'pdpData.articleAttributes.Body Shape ID': 'Shape ID 424,Shape ID 333,Shape ID 324,Shape ID 443',
'pdpData.articleAttributes.Brand Fit Name': 'NA',
'pdpData.articleAttributes.Closure': 'Elasticated',
'pdpData.articleAttributes.Fabric': 'Polyester',
'pdpData.articleAttributes.Fabric 2': 'NA',
'pdpData.articleAttributes.Fabric 3': 'NA',
'pdpData.articleAttributes.Fit': 'Regular',
'pdpData.articleAttributes.Length': 'Long',
'pdpData.articleAttributes.Occasion': 'Casual',
'pdpData.articleAttributes.Pattern': 'Printed',
'pdpData.articleAttributes.Print / Pattern Type': 'Others',
'pdpData.articleAttributes.Surface Styling / Features': 'NA',
'pdpData.articleAttributes.Type': 'Palazzos',
'pdpData.articleAttributes.Waist Rise': 'Mid',
'pdpData.articleNumber': 'P700418XL-Red-1193441',
'pdpData.articleType.active': True,
'pdpData.articleType.filterOrder': 84L,
'pdpData.articleType.id': 78L,
'pdpData.articleType.isExchangeable': True,
'pdpData.articleType.isFragile': False,
'pdpData.articleType.isHazmat': False,
'pdpData.articleType.isJewellery': False,
'pdpData.articleType.isLarge': False,
'pdpData.articleType.isReturnable': True,
'pdpData.articleType.isTryAndBuyEnabled': True,
'pdpData.articleType.pickupEnabled': True,
'pdpData.articleType.socialSharingEnabled': True,
'pdpData.articleType.typeCode': 'TRSR',
'pdpData.articleType.typeName': 'Trousers',
'pdpData.baseColour': 'Maroon',
'pdpData.brandDetailsEntry.id': 7991L,
'pdpData.brandDetailsEntry.name': 'Trend Arrest',
'pdpData.brandName': 'Trend Arrest',
'pdpData.catalogAddDate': 1468847698L,
'pdpData.catalogDate': 1453964982L,
'pdpData.codEnabled': 'Y',
'pdpData.colour1': 'NA',
'pdpData.colour2': 'NA',
'pdpData.comments': 'westernwearfest-topsellers2016',
'pdpData.crossLinks': [
{
'key': 'More Trousers by Trend Arrest',
'value': 'trousers?f=brand:Trend Arrest::gender:women',
},
{
'key': 'More Maroon Trousers',
'value': 'trousers?f=colour:Maroon::gender:women',
},
{'key': 'More Trousers', 'value': 'trousers?f=gender:women'},
],
'pdpData.discountData.discountAmount': 649.5,
'pdpData.discountData.discountFunding': 'vendor-EOSS',
'pdpData.discountData.discountId': 912071L,
'pdpData.discountData.discountLimit': 30L,
'pdpData.discountData.discountModifiedDate': 1479460272186L,
'pdpData.discountData.discountPercent': 50L,
'pdpData.discountData.discountRuleHistoryId': 1548747L,
'pdpData.discountData.discountRuleId': 912089L,
'pdpData.discountData.discountText.hasFreeItem': False,
'pdpData.discountData.discountText.text': '(50% OFF)',
'pdpData.discountData.discountToolTipText.hasFreeItem': False,
'pdpData.discountData.discountToolTipText.text': 'Buy this item and get <em>50% </em> off',
'pdpData.discountData.discountType': 1L,
'pdpData.discountData.fundingPercentage': 60L,
'pdpData.discountData.icon': 'Flat_Cart_Icon',
'pdpData.discountData.id': 'Flat_Cart_P',
'pdpData.discountData.styleType': 'Style',
'pdpData.discountedPrice': 649L,
'pdpData.fashionType': 'Fashion',
'pdpData.gender': 'Women',
'pdpData.id': 1193441L,
'pdpData.isFlatShotAvailable': 0L,
'pdpData.landingPageUrl': 'Trousers/Trend-Arrest/Trend-Arrest-Maroon-Printed-Palazzo-Trousers/1193441/buy',
'pdpData.masterCategory.active': True,
'pdpData.masterCategory.filterOrder': 0L,
'pdpData.masterCategory.id': 9L,
'pdpData.masterCategory.isExchangeable': True,
'pdpData.masterCategory.isFragile': False,
'pdpData.masterCategory.isHazmat': False,
'pdpData.masterCategory.isJewellery': False,
'pdpData.masterCategory.isLarge': False,
'pdpData.masterCategory.isReturnable': True,
'pdpData.masterCategory.isTryAndBuyEnabled': True,
'pdpData.masterCategory.pickupEnabled': True,
'pdpData.masterCategory.socialSharingEnabled': True,
'pdpData.masterCategory.typeCode': '',
'pdpData.masterCategory.typeName': 'Apparel',
'pdpData.modifiedDate': 1532709720000L,
'pdpData.myntraRating': 0L,
'pdpData.navigationId': 0L,
'pdpData.price': 1299L,
'pdpData.productDescriptors.description.descriptorType': 'description',
'pdpData.productDescriptors.description.value': '<p>A pair of maroon printed mid-rise palazzo trousers, has an elasticated waistband, flared hems</p>',
'pdpData.productDescriptors.materials_care_desc.descriptorType': 'materials_care_desc',
'pdpData.productDescriptors.materials_care_desc.value': '<p>Polyester<br>Machine-wash cold</p>',
'pdpData.productDescriptors.size_fit_desc.descriptorType': 'size_fit_desc',
'pdpData.productDescriptors.size_fit_desc.value': '<p>The model (height 5\'8" and waist 28") is wearing a size 28</p>',
'pdpData.productDescriptors.style_note.descriptorType': 'style_note',
'pdpData.productDescriptors.style_note.value': '<p>Look fabulous and trendy as you step out in this pair of palazzo trousers. Team it with a top or a crop top and pumps for a chic ensemble.</p>',
'pdpData.productDisplayName': 'Trend Arrest Maroon Printed Palazzo Trousers',
'pdpData.productTag': 'Trend Arrest,JIT,ss16launch-women-alloverprintsnew,ss16launch-women-widelegpants,ss16launch-women-alloverprintsnew,HH10FEB16,ss16launch-women-alloverprintsnew,rock-bohemian-style,skirts-for-casual-day-out,nude-pumps-complete-outfit,new-arrivals-offer-10apr,casual-wear-offer-10apr,new-styles-offer-14apr,new-arrival-offer-apr16,grand-premium-30-to-50-off,rs-500-off-22may,new-arrivals-offer-22may,women-western-rfm-2016,rs-500-off-28may,500rs-1jun,rs-500-off-5jun,rs-500-off-june-pn,college-look-print-madness,College-store-pallazos-leggings-women,rs-500-off-26june,college-store,College-store-ethnic-bold-women,500rs-5jul,college-store-view-all,rs-500-off-10jul,rs500-off-17july,500-off-26jul,500-rs-off-10aug,rakhi-store-skirts-palazzos,rs500-off-17aug,inb-august,top-at-august,rs-500-24aug,tat-styles-31aug,off-1000-500-8sep,500-13sep,bottomwear-pre-bbd-sale,bbd-pre-sale-2016,bbd-pre-sale-categories-2016,bbd-one-last,diwali-women-western-oct,wedding-bride-honeymoon-jeans-trousers,myntra-open-coupon-offer,new-customer-Offer,wedding-bride-honeymoon-pack-list-all,ola-offer-nov16,westernwearfest-topsellers2016',
'pdpData.productTypeId': 367L,
'pdpData.recommendations.alsoPopular': [
'append andcat in subtemplate ALL with Women,Apparel',
],
'pdpData.recommendations.matchWith': [
'append andcat in subtemplate ALL with Women',
'append orcat in subtemplate ALL with Shirts',
],
'pdpData.season': 'Summer',
'pdpData.styleImages.back.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.back.imageType': 'back',
'pdpData.styleImages.back.imageURL': 'http://assets.myntassets.com/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.path': 'http://assets.myntassets.com/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.relativePath': 'assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutionFormula': 'h_($height),q_($qualityPercentage),w_($width)/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.1080X1440': 'http://assets.myntassets.com/h_1440,q_95,w_1080/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.1080X1440Xmini': 'http://assets.myntassets.com/h_1440,q_95,w_1080/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.resolutions.125X161': 'http://assets.myntassets.com/h_161,q_95,w_125/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.125X161Xmini': 'http://assets.myntassets.com/h_161,q_95,w_125/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.resolutions.150X200': 'http://assets.myntassets.com/h_200,q_95,w_150/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.150X200Xmini': 'http://assets.myntassets.com/h_200,q_95,w_150/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.resolutions.180X240': 'http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.180X240Xmini': 'http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.resolutions.360X480': 'http://assets.myntassets.com/h_480,q_95,w_360/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.360X480Xmini': 'http://assets.myntassets.com/h_480,q_95,w_360/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.resolutions.48X64': 'http://assets.myntassets.com/h_64,q_95,w_48/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.48X64Xmini': 'http://assets.myntassets.com/h_64,q_95,w_48/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.resolutions.81X108': 'http://assets.myntassets.com/h_108,q_95,w_81/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3.jpg',
'pdpData.styleImages.back.resolutions.81X108Xmini': 'http://assets.myntassets.com/h_108,q_95,w_81/v1/assets/images/1193441/2016/1/27/11453879129093-Trend-Arrest-Women-Trousers-8751453879128667-3_mini.jpg',
'pdpData.styleImages.back.securedDomain': 'https://secureassets.myntassets.com/',
'pdpData.styleImages.back.servingUploaderType': 'CL',
'pdpData.styleImages.back.storedUploaderType': 'CL',
'pdpData.styleImages.back.supportedResolutions': '1080X1440,540X720,360X480,48X64,81X108',
'pdpData.styleImages.default.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.default.imageType': 'default',
'pdpData.styleImages.default.imageURL': 'http://assets.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.path': 'http://assets.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.relativePath': 'assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutionFormula': 'h_($height),q_($qualityPercentage),w_($width)/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.1080X1440': 'http://assets.myntassets.com/h_1440,q_95,w_1080/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.1080X1440Xmini': 'http://assets.myntassets.com/h_1440,q_95,w_1080/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.resolutions.125X161': 'http://assets.myntassets.com/h_161,q_95,w_125/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.125X161Xmini': 'http://assets.myntassets.com/h_161,q_95,w_125/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.resolutions.150X200': 'http://assets.myntassets.com/h_200,q_95,w_150/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.150X200Xmini': 'http://assets.myntassets.com/h_200,q_95,w_150/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.resolutions.180X240': 'http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.180X240Xmini': 'http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.resolutions.360X480': 'http://assets.myntassets.com/h_480,q_95,w_360/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.360X480Xmini': 'http://assets.myntassets.com/h_480,q_95,w_360/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.resolutions.48X64': 'http://assets.myntassets.com/h_64,q_95,w_48/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.48X64Xmini': 'http://assets.myntassets.com/h_64,q_95,w_48/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.resolutions.81X108': 'http://assets.myntassets.com/h_108,q_95,w_81/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default.resolutions.81X108Xmini': 'http://assets.myntassets.com/h_108,q_95,w_81/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.default.securedDomain': 'https://secureassets.myntassets.com/',
'pdpData.styleImages.default.servingUploaderType': 'CL',
'pdpData.styleImages.default.storedUploaderType': 'CL',
'pdpData.styleImages.default.supportedResolutions': '1080X1440,540X720,180X240,360X480,150X200,96X128,81X108,48X64',
'pdpData.styleImages.default_deprecated.domain': 'http://myntra.myntassets.com/',
'pdpData.styleImages.default_deprecated.imageType': 'default_deprecated',
'pdpData.styleImages.default_deprecated.imageURL': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default_deprecated.path': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default_deprecated.relativePath': 'assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.default_deprecated.resolutionFormula': 'assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_($width)_($height).jpg',
'pdpData.styleImages.default_deprecated.resolutions.1080X1440': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_1080_1440.jpg',
'pdpData.styleImages.default_deprecated.resolutions.1080X1440Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_1080_1440_mini.jpg',
'pdpData.styleImages.default_deprecated.resolutions.125X161': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_150_200.jpg',
'pdpData.styleImages.default_deprecated.resolutions.125X161Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_150_200_mini.jpg',
'pdpData.styleImages.default_deprecated.resolutions.150X200': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_150_200.jpg',
'pdpData.styleImages.default_deprecated.resolutions.150X200Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_150_200_mini.jpg',
'pdpData.styleImages.default_deprecated.resolutions.180X240': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_180_240.jpg',
'pdpData.styleImages.default_deprecated.resolutions.180X240Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_180_240_mini.jpg',
'pdpData.styleImages.default_deprecated.resolutions.360X480': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_360_480.jpg',
'pdpData.styleImages.default_deprecated.resolutions.360X480Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_360_480_mini.jpg',
'pdpData.styleImages.default_deprecated.resolutions.48X64': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_48_64.jpg',
'pdpData.styleImages.default_deprecated.resolutions.48X64Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_48_64_mini.jpg',
'pdpData.styleImages.default_deprecated.resolutions.81X108': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_81_108.jpg',
'pdpData.styleImages.default_deprecated.resolutions.81X108Xmini': 'http://myntra.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_81_108_mini.jpg',
'pdpData.styleImages.default_deprecated.securedDomain': 'https://myntrawebimages.s3.amazonaws.com/',
'pdpData.styleImages.default_deprecated.servingUploaderType': 'S3',
'pdpData.styleImages.default_deprecated.storedUploaderType': 'S3',
'pdpData.styleImages.default_deprecated.supportedResolutions': '1080X1440,540X720,180X240,360X480,150X200,96X128,81X108,48X64',
'pdpData.styleImages.front.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.front.imageType': 'front',
'pdpData.styleImages.front.servingUploaderType': 'CL',
'pdpData.styleImages.front.storedUploaderType': 'CL',
'pdpData.styleImages.front.supportedResolutions': '1080X1440,540X720,360X480,48X64,81X108',
'pdpData.styleImages.left.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.left.servingUploaderType': 'CL',
'pdpData.styleImages.left.storedUploaderType': 'CL',
'pdpData.styleImages.left.supportedResolutions': '1080X1440,540X720,360X480,48X64,81X108',
'pdpData.styleImages.right.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.right.imageType': 'right',
'pdpData.styleImages.right.servingUploaderType': 'CL',
'pdpData.styleImages.right.storedUploaderType': 'CL',
'pdpData.styleImages.right.supportedResolutions': '1080X1440,540X720,360X480,48X64,81X108',
'pdpData.styleImages.search.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.search.imageType': 'search',
'pdpData.styleImages.search.imageURL': 'http://assets.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.path': 'http://assets.myntassets.com/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.relativePath': 'assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutionFormula': 'h_($height),q_($qualityPercentage),w_($width)/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.1080X1440': 'http://assets.myntassets.com/h_1440,q_95,w_1080/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.1080X1440Xmini': 'http://assets.myntassets.com/h_1440,q_95,w_1080/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.resolutions.125X161': 'http://assets.myntassets.com/h_161,q_95,w_125/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.125X161Xmini': 'http://assets.myntassets.com/h_161,q_95,w_125/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.resolutions.150X200': 'http://assets.myntassets.com/h_200,q_95,w_150/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.150X200Xmini': 'http://assets.myntassets.com/h_200,q_95,w_150/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.resolutions.180X240': 'http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.180X240Xmini': 'http://assets.myntassets.com/h_240,q_95,w_180/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.resolutions.360X480': 'http://assets.myntassets.com/h_480,q_95,w_360/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.360X480Xmini': 'http://assets.myntassets.com/h_480,q_95,w_360/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.resolutions.48X64': 'http://assets.myntassets.com/h_64,q_95,w_48/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.48X64Xmini': 'http://assets.myntassets.com/h_64,q_95,w_48/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.resolutions.81X108': 'http://assets.myntassets.com/h_108,q_95,w_81/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1.jpg',
'pdpData.styleImages.search.resolutions.81X108Xmini': 'http://assets.myntassets.com/h_108,q_95,w_81/v1/assets/images/1193441/2016/1/27/11453879129257-Trend-Arrest-Women-Trousers-8751453879128667-1_mini.jpg',
'pdpData.styleImages.search.securedDomain': 'https://secureassets.myntassets.com/',
'pdpData.styleImages.search.servingUploaderType': 'CL',
'pdpData.styleImages.search.storedUploaderType': 'CL',
'pdpData.styleImages.search.supportedResolutions': '1080X1440,540X720,180X240,360X480,150X200,96X128,81X108,48X64',
'pdpData.styleImages.size_representation.imageType': 'size_representation',
'pdpData.styleImages.size_representation.imageURL': 'images/style/sizechart/Trousers_Adults-Women.png',
'pdpData.styleImages.top.domain': 'http://assets.myntassets.com/',
'pdpData.styleImages.top.imageType': 'top',
'pdpData.styleImages.top.supportedResolutions': '1080X1440,540X720,360X480,48X64,81X108',
'pdpData.styleOptions': [
{
'active': True,
'allSize': '28',
'available': True,
'id': 9677369,
'inventoryCount': 27,
'name': 'Size',
'skuAvailabilityDetailMap': {
'21': {
'availableCount': 27,
'availableInWarehouses': '28',
'leadTime': 0,
'sellerid': 21,
'sellername': 'Health & Happiness Pvt Ltd',
'storeid': 1,
'supplyType': 'ON_HAND',
},
},
'skuId': 9677369,
'taxEntry': {'skuId': 9677369, 'taxRate': 5.25},
'unifiedSize': '28',
'unifiedSizeValue': '28',
'value': 'S',
'warehouseIdToItemCountMap': {},
},
{
'active': True,
'allSize': '30',
'available': True,
'id': 9677372,
'inventoryCount': 3,
'name': 'Size',
'skuAvailabilityDetailMap': {
'21': {
'availableCount': 3,
'availableInWarehouses': '96',
'leadTime': 3,
'sellerid': 21,
'sellername': 'Health & Happiness Pvt Ltd',
'storeid': 1,
'supplyType': 'JUST_IN_TIME',
},
},
'skuId': 9677372,
'taxEntry': {'skuId': 9677372, 'taxRate': 5},
'unifiedSize': '30',
'unifiedSizeValue': '30',
'value': 'M',
'warehouseIdToItemCountMap': {},
},
{
'active': True,
'allSize': '32',
'available': True,
'id': 9677375,
'inventoryCount': 4,
'name': 'Size',
'skuAvailabilityDetailMap': {
'21': {
'availableCount': 4,
'availableInWarehouses': '28',
'leadTime': 0,
'sellerid': 21,
'sellername': 'Health & Happiness Pvt Ltd',
'storeid': 1,
'supplyType': 'ON_HAND',
},
},
'skuId': 9677375,
'taxEntry': {'skuId': 9677375, 'taxRate': 5.25},
'unifiedSize': '32',
'unifiedSizeValue': '32',
'value': 'L',
'warehouseIdToItemCountMap': {},
},
{
'active': True,
'allSize': '34',
'available': True,
'id': 9677378,
'inventoryCount': 1,
'name': 'Size',
'skuAvailabilityDetailMap': {
'21': {
'availableCount': 1,
'availableInWarehouses': '28',
'leadTime': 0,
'sellerid': 21,
'sellername': 'Health & Happiness Pvt Ltd',
'storeid': 1,
'supplyType': 'ON_HAND',
},
},
'skuId': 9677378,
'taxEntry': {'skuId': 9677378, 'taxRate': 5.25},
'unifiedSize': '34',
'unifiedSizeValue': '34',
'value': 'XL',
'warehouseIdToItemCountMap': {},
},
],
'pdpData.styleType': 'P',
'pdpData.subCategory.active': True,
'pdpData.subCategory.filterOrder': 0L,
'pdpData.subCategory.id': 29L,
'pdpData.subCategory.isExchangeable': True,
'pdpData.subCategory.isFragile': False,
'pdpData.subCategory.isHazmat': False,
'pdpData.subCategory.isJewellery': False,
'pdpData.subCategory.isLarge': False,
'pdpData.subCategory.isReturnable': True,
'pdpData.subCategory.isTryAndBuyEnabled': True,
'pdpData.subCategory.pickupEnabled': True,
'pdpData.subCategory.socialSharingEnabled': True,
'pdpData.subCategory.typeCode': '',
'pdpData.subCategory.typeName': 'Bottomwear',
'pdpData.usage': 'Casual',
'pdpData.variantName': 'Printed Palazzo Pants',
'pdpData.vat': 5.5,
'pdpData.visualTag': '',
'pdpData.weight': '0',
'pdpData.year': '2016',}
the code which I am trying
res = es.index(index = INDEX_NAME, doc_type=TYPE_NAME, id=i, body = doc)
error is as shown below
raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: TransportError(400, u'mapper_parsing_exception', u'failed to parse')