How can I bulk insert data?

Hello,
I have the following json data that I like to post to the server using the _bulk API.

{
    "price": 274000.00,
    "original_price": 277900.00,
    "summary": "WHAT A FANTASTIC PROPERTY!! GREAT LOCATION IN DESERT SHORES, LOVELY COMMUNITY WITH COMMUNITY LAKE,SWIMMING POOL & PLAYGROUND!! NEW CARPET FRESH PAINT WAIT UNTIL YOU SEE!! FANTASTIC ENTRY WITH OPEN LAYOUT W/ WOOD-LIKE VINYL FLOORING THAT OPENS UP TO FANTASTIC KITCHEN W/ TILE FLOORING, TILE COUNTER TOPS AND PLENTY OF CABINET SPACE THAT OPENS UP TO LOVELY DINING AREA! COME VIEW!!***LEASE BUYOUT AVAILABLE***",
    "street_number": "7633",
    "street_name": "SEA CLIFF",
    "street_suffix": "Way",
    "city": "Las Vegas",
    "state_or_province": "Nevada",
    "postal_code": "89128",
    "mlsid": "2024579",
    "source_id": "133771881",
    "type": "Residential",
    "subtype": "Single Family Residential",
    "year_built": 1988,
    "community": "Desert Shores",
    "schools": null,
    "area_size": 1404.0,
    "lot_size": 3920.0,
    "status": "Sold",
    "bathrooms": 2.00,
    "bedrooms": 3.0,
    "listed_at": "2018-08-21T00:00:00",
    "sold_at": null,
    "sold_for": null,
    "total_photos": null,
    "location": {
        "lat": null,
        "lon": null
    },
    "fields": {
        "AccessibilityFeatures": "",
        "ActiveOpenHouseCount": "0",
        "AdditionalAUSoldTerms": "",
        "AdditionalLivArea": "",
        "AdditionalPetRentYN": "",
        "AdministrationDeposit": "",
        "AdministrationFeeYN": "",
        "AdministrationRefund": "",
        "AgeRestrictedCommunityYN": "0",
        "AmtOwnerWillCarry": "",
        "AnnualPropertyTaxes": "1425",
        "ApplicationFeeAmount": "",
        "ApplicationFeeYN": "",
        "ApproxAddlLivArea": "",
        "ApproxTotalLivArea": "1404",
        "AppxAssociationFee": "",
        "AppxSubfeeAmount": "",
        "AppxSubfeePymtTy": "",
        "Area": "403 - North West",
        "AssessedImpValue": "",
        "AssessedLandValue": "",
        "AssessmentBalance": "",
        "Assessments": "",
        "AssessmentType": "",
        "AssessmentYN": "0",
        "AssociationFeaturesAvailable": "CC&RS",
        "AssociationFee1": "84",
        "AssociationFee1MQYN": "Monthly",
        "AssociationFee2": "",
        "AssociationFee2MQYN": "",
        "AssociationFeeIncludes": "Management",
        "AssociationFeeMQYN": "",
        "AssociationFeeYN": "1",
        "AssociationName": "Desert Shores",
        "AssociationPhone": "702-254-1020",
        "AuctionDate": "",
        "AuctionType": "",
        "AVMYN": "1",
        "BathDownstairsDescription": "",
        "BathDownYN": "1",
        "BathsFull": "2",
        "BathsHalf": "0",
        "BedandBathDownYN": "",
        "BedroomDownstairsYN": "1",
        "BedroomsTotalPossibleNum": "3",
        "BlockNumber": "",
        "BonusSOYN": "",
        "BrandedVirtualTour": "",
        "Builder": "",
        "BuildingDescription": "1  Story",
        "BuildingNumber": "",
        "BuiltDescription": "RESALE",
        "BuyerPremium": "",
        "CableAvailable": "",
        "CapRate": "",
        "CarportDescription": "",
        "Carports": "0",
        "CashtoAssume": "",
        "CensusTract": "3247",
        "CleaningDeposit": "",
        "CleaningRefund": "",
        "CloseDate": "2021-03-10",
        "ClosePrice": "274000.00",
        "CompactorYN": "",
        "ConditionalDate": "",
        "CondoConversionYN": "",
        "ConstructionDescription": "",
        "ConstructionEstimateEnd": "",
        "ConstructionEstimateStart": "",
        "ContingencyDesc": "",
        "ConvertedGarageYN": "0",
        "ConvertedtoRealProperty": "",
        "CoolingDescription": "",
        "CoolingFuel": "Electric",
        "CostperUnit": "",
        "CountyOrParish": "Clark County",
        "CourtApproval": "0",
        "CrossStreet": "",
        "CurrentLoanAssumable": "",
        "DateAvailable": "",
        "Deposit": "",
        "Directions": "From  W Lake Mead Blvd, Turn right onto Mariner Dr, Turn right onto Sea Pointe Way, Turn left onto Cove Rd, Cove Rd turns right and becomes Sea Cliff Way",
        "DishwasherDescription": "",
        "DishwasherYN": "1",
        "DisposalYN": "0",
        "DOM": "818",
        "DomModifier_DateTime": "",
        "DomModifier_Initial": "",
        "DomModifier_StatusRValue": "",
        "DownPayment": "",
        "DryerIncluded": "0",
        "DryerUtilities": "Gas",
        "EarnestDeposit": "3000",
        "Electricity": "",
        "ElevatorFloorNum": "",
        "EnergyDescription": "None",
        "EnvironmentSurvey": "",
        "EquestrianDescription": "None",
        "EstCloLsedt": "2021-03-12T00:00:00.000",
        "ExistingRent": "1442",
        "ExpenseSource": "",
        "ExteriorDescription": "Accessibility,Back Yard Access",
        "Fence": "Backyard Full Fenced",
        "FenceType": "Block",
        "FinancingConsidered": "Cash,Conventional,FHA,VA",
        "Fireplace": "",
        "FireplaceDescription": "Gas",
        "FireplaceLocation": "Family Room",
        "Fireplaces": "1",
        "FirstEncumbranceAssumable": "",
        "FirstEncumbranceBalance": "",
        "FirstEncumbrancePayment": "",
        "FirstEncumbrancePmtDesc": "",
        "FirstEncumbranceRate": "",
        "FloodZone": "",
        "FlooringDescription": "Carpet,Tile",
        "ForeclosureCommencedYN": "0",
        "FurnishedYN": "",
        "FurnishingsDescription": "",
        "FurnitureIncluded": "",
        "Garage": "2",
        "GarageDescription": "Attached",
        "GasDescription": "",
        "GatedYN": "0",
        "GravelRoad": "",
        "GreenBuildingCertificationYN": "0",
        "GreenCertificationRating": "",
        "GreenCertifyingBody": "",
        "GreenFeatures": "",
        "GreenYearCertified": "",
        "GrossOperatingIncome": "",
        "GrossRentMultiplier": "",
        "GroundMountedYN": "",
        "HandicapAdapted": "",
        "HeatingDescription": "Central",
        "HeatingFuel": "Gas",
        "HiddenFranchiseIDXOptInYN": "",
        "Highlights": "",
        "HOAMinimumRentalCycle": "",
        "HOAYN": "",
        "HomeownerAssociationName": "",
        "HomeownerAssociationPhoneNo": "",
        "HomeProtectionPlan": "",
        "HotWater": "",
        "HouseFaces": "North",
        "HouseViews": "",
        "IDX": "Y",
        "IDXOptInYN": "1",
        "Interior": "None",
        "InternetYN": "1",
        "JuniorSuiteunder600sqft": "",
        "KeyDeposit": "",
        "KeyRefund": "",
        "KitchenCountertops": "",
        "LandlordOwnerPays": "",
        "LandscapeDescription": "Desert Landscaping",
        "LandUse": "110-Res-Sngl Fam",
        "LastChangeTimestamp": "2021-03-10T16:54:01.983",
        "LastChangeType": "Sold",
        "LastStatus": "Under Contract - No Show",
        "LeaseDescription": "",
        "LeaseOptionConsideredY": "",
        "LeasePrice": "",
        "LeedCertified": "",
        "LegalDescription": "",
        "Length": "",
        "ListAgent_MUI": "9638743",
        "ListAgentMLSID": "228109",
        "ListingAgreementType": "Active-Exclusive Right",
        "ListOffice_MUI": "1004068",
        "ListOfficeMLSID": "BMCM",
        "ListOfficeName": "Griffin Group Realty",
        "ListOfficePhone": "702-479-0079",
        "ListPrice": "274900.00",
        "Litigation": "No",
        "NODDate": "",
        "NOI": "",
        "NumAcres": "0.0900",
        "NumberofFurnishedUnits": "",
        "NumberofPets": "",
        "NumBldgs": "",
        "NumDenOther": "0",
        "NumFloors": "",
        "NumGAcres": "",
        "NumLoft": "0",
        "NumofLoftAreas": "",
        "NumofParkingSpacesIncluded": "",
        "NumParcels": "",
        "NumParking": "",
        "NumStorageUnits": "",
        "NumTerraces": "",
        "NumUnits": "",
        "OffMarketDate": "2021-01-08",
        "OnSiteStaff": "",
        "OnSiteStaffIncludes": "",
        "OriginalEntryTimestamp": "2018-08-21T17:45:49.823",
        "OriginalListPrice": "319900.00",
        "OtherApplianceDescription": "None",
        "OtherDeposit": "",
        "OtherEncumbranceDesc": "",
        "OtherIncomeDescription": "",
        "OtherRefund": "",
        "OvenDescription": "Cooktop(G)",
        "OvenFuel": "",
        "OwnerLicensee": "Yes",
        "OwnerManaged": "",
        "Ownership": "",
        "OwnersName": "",
        "OwnerWillCarry": "",
        "PackageAvailable": "",
        "ParcelNumber": "138-16-815-048",
        "ParkingDescription": "",
        "ParkingLevel": "",
        "ParkingSpaceIDNum": "",
        "PavedRoad": "",
        "PendingDate": "2021-01-08",
        "PermittedPropertyManager": "",
        "PerPetYN": "",
        "PetDeposit": "",
        "PetDescription": "",
        "PetRefund": "",
        "PetsAllowed": "",
        "PhotoCount": "50",
        "PhotoExcluded": "",
        "PoolDescription": "",
        "PoolLength": "",
        "PoolWidth": "",
        "PostalCodePlus4": "",
        "PoweronorOff": "Power ON",
        "PreviousParcelNumber": "",
        "PriceChangeTimestamp": "2020-09-09T14:58:17.380",
        "PriceChgDate": ""
    },
    "price_changes": [
        {
            "set_at": "2021-03-15T23:39:31.9271481Z",
            "price": 274000.00,
            "delta": -3900.00
        }
    ],
    "amenities": null,
    "elementary_school": "Eisenberg Dorothy",
    "middle_school": "Eisenberg Dorothy",
    "jr_high_school": "Becker",
    "high_school": "Cimarron-Memorial",
    "deleted_at": null,
    "is_available": false,
    "is_unable_to_find_coordinates": false,
    "source": "abc"
}

I tried different ways but I always get the following

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Malformed action/metadata line [3], expected START_OBJECT but found [VALUE_STRING]"
    },
    "status": 400
}

The bulk API expects a specific format as described in the documentation.

  • 1 line for the header (action to be performed)
  • 1 line for the content (unless you are doing a DELETE)

@dadoonet I tried the follow but still getting the same error

{"create": {"_index": "my_index_name"}}
{
    "price": 274000.00,
    "original_price": 277900.00,
    "summary": "WHAT A FANTASTIC PROPERTY!! GREAT LOCATION IN DESERT SHORES, LOVELY COMMUNITY WITH COMMUNITY LAKE,SWIMMING POOL & PLAYGROUND!! NEW CARPET FRESH PAINT WAIT UNTIL YOU SEE!! FANTASTIC ENTRY WITH OPEN LAYOUT W/ WOOD-LIKE VINYL FLOORING THAT OPENS UP TO FANTASTIC KITCHEN W/ TILE FLOORING, TILE COUNTER TOPS AND PLENTY OF CABINET SPACE THAT OPENS UP TO LOVELY DINING AREA! COME VIEW!!***LEASE BUYOUT AVAILABLE***",
    "street_number": "7633",
    "street_name": "SEA CLIFF",
    "street_suffix": "Way",
    "city": "Las Vegas",
    "state_or_province": "Nevada",
    "postal_code": "89128",
    "mlsid": "2024579",
    "source_id": "133771881",
    "type": "Residential",
    "subtype": "Single Family Residential",
    "year_built": 1988,
    "community": "Desert Shores",
    "schools": null,
    "area_size": 1404.0,
    "lot_size": 3920.0,
    "status": "Sold",
    "bathrooms": 2.00,
    "bedrooms": 3.0,
    "listed_at": "2018-08-21T00:00:00",
    "sold_at": null,
    "sold_for": null,
    "total_photos": null,
    "location": {
        "lat": null,
        "lon": null
    },
    "fields": {
        "AccessibilityFeatures": "",
        "ActiveOpenHouseCount": "0",
        "AdditionalAUSoldTerms": "",
        "AdditionalLivArea": "",
        "AdditionalPetRentYN": "",
        "AdministrationDeposit": "",
        "AdministrationFeeYN": "",
        "AdministrationRefund": "",
        "AgeRestrictedCommunityYN": "0",
        "AmtOwnerWillCarry": "",
        "AnnualPropertyTaxes": "1425",
        "ApplicationFeeAmount": "",
        "ApplicationFeeYN": "",
        "ApproxAddlLivArea": "",
        "ApproxTotalLivArea": "1404",
        "AppxAssociationFee": "",
        "AppxSubfeeAmount": "",
        "AppxSubfeePymtTy": "",
        "Area": "403 - North West",
        "AssessedImpValue": "",
        "AssessedLandValue": "",
        "AssessmentBalance": "",
        "Assessments": "",
        "AssessmentType": "",
        "AssessmentYN": "0",
        "AssociationFeaturesAvailable": "CC&RS",
        "AssociationFee1": "84",
        "AssociationFee1MQYN": "Monthly",
        "AssociationFee2": "",
        "AssociationFee2MQYN": "",
        "AssociationFeeIncludes": "Management",
        "AssociationFeeMQYN": "",
        "AssociationFeeYN": "1",
        "AssociationName": "Desert Shores",
        "AssociationPhone": "702-254-1020",
        "AuctionDate": "",
        "AuctionType": "",
        "AVMYN": "1",
        "BathDownstairsDescription": "",
        "BathDownYN": "1",
        "BathsFull": "2",
        "BathsHalf": "0",
        "BedandBathDownYN": "",
        "BedroomDownstairsYN": "1",
        "BedroomsTotalPossibleNum": "3",
        "BlockNumber": "",
        "BonusSOYN": "",
        "BrandedVirtualTour": "",
        "Builder": "",
        "BuildingDescription": "1  Story",
        "BuildingNumber": "",
        "BuiltDescription": "RESALE",
        "BuyerPremium": "",
        "CableAvailable": "",
        "CapRate": "",
        "CarportDescription": "",
        "Carports": "0",
        "CashtoAssume": "",
        "CensusTract": "3247",
        "CleaningDeposit": "",
        "CleaningRefund": "",
        "CloseDate": "2021-03-10",
        "ClosePrice": "274000.00",
        "CompactorYN": "",
        "ConditionalDate": "",
        "CondoConversionYN": "",
        "ConstructionDescription": "",
        "ConstructionEstimateEnd": "",
        "ConstructionEstimateStart": "",
        "ContingencyDesc": "",
        "ConvertedGarageYN": "0",
        "ConvertedtoRealProperty": "",
        "CoolingDescription": "",
        "CoolingFuel": "Electric",
        "CostperUnit": "",
        "CountyOrParish": "Clark County",
        "CourtApproval": "0",
        "CrossStreet": "",
        "CurrentLoanAssumable": "",
        "DateAvailable": "",
        "Deposit": "",
        "Directions": "From  W Lake Mead Blvd, Turn right onto Mariner Dr, Turn right onto Sea Pointe Way, Turn left onto Cove Rd, Cove Rd turns right and becomes Sea Cliff Way",
        "DishwasherDescription": "",
        "DishwasherYN": "1",
        "DisposalYN": "0",
        "DOM": "818",
        "DomModifier_DateTime": "",
        "DomModifier_Initial": "",
        "DomModifier_StatusRValue": "",
        "DownPayment": "",
        "DryerIncluded": "0",
        "DryerUtilities": "Gas",
        "EarnestDeposit": "3000",
        "Electricity": "",
        "ElevatorFloorNum": "",
        "EnergyDescription": "None",
        "EnvironmentSurvey": "",
        "EquestrianDescription": "None",
        "EstCloLsedt": "2021-03-12T00:00:00.000",
        "ExistingRent": "1442",
        "ExpenseSource": "",
        "ExteriorDescription": "Accessibility,Back Yard Access",
        "Fence": "Backyard Full Fenced",
        "FenceType": "Block",
        "FinancingConsidered": "Cash,Conventional,FHA,VA",
        "Fireplace": "",
        "FireplaceDescription": "Gas",
        "FireplaceLocation": "Family Room",
        "Fireplaces": "1",
        "FirstEncumbranceAssumable": "",
        "FirstEncumbranceBalance": "",
        "FirstEncumbrancePayment": "",
        "FirstEncumbrancePmtDesc": "",
        "FirstEncumbranceRate": "",
        "FloodZone": "",
        "FlooringDescription": "Carpet,Tile",
        "ForeclosureCommencedYN": "0",
        "FurnishedYN": "",
        "FurnishingsDescription": "",
        "FurnitureIncluded": "",
        "Garage": "2",
        "GarageDescription": "Attached",
        "GasDescription": "",
        "GatedYN": "0",
        "GravelRoad": "",
        "GreenBuildingCertificationYN": "0",
        "GreenCertificationRating": "",
        "GreenCertifyingBody": "",
        "GreenFeatures": "",
        "GreenYearCertified": "",
        "GrossOperatingIncome": "",
        "GrossRentMultiplier": "",
        "GroundMountedYN": "",
        "HandicapAdapted": "",
        "HeatingDescription": "Central",
        "HeatingFuel": "Gas",
        "HiddenFranchiseIDXOptInYN": "",
        "Highlights": "",
        "HOAMinimumRentalCycle": "",
        "HOAYN": "",
        "HomeownerAssociationName": "",
        "HomeownerAssociationPhoneNo": "",
        "HomeProtectionPlan": "",
        "HotWater": "",
        "HouseFaces": "North",
        "HouseViews": "",
        "IDX": "Y",
        "IDXOptInYN": "1",
        "Interior": "None",
        "InternetYN": "1",
        "JuniorSuiteunder600sqft": "",
        "KeyDeposit": "",
        "KeyRefund": "",
        "KitchenCountertops": "",
        "LandlordOwnerPays": "",
        "LandscapeDescription": "Desert Landscaping",
        "LandUse": "110-Res-Sngl Fam",
        "LastChangeTimestamp": "2021-03-10T16:54:01.983",
        "LastChangeType": "Sold",
        "LastStatus": "Under Contract - No Show",
        "LeaseDescription": "",
        "LeaseOptionConsideredY": "",
        "LeasePrice": "",
        "LeedCertified": "",
        "LegalDescription": "",
        "Length": "",
        "ListAgent_MUI": "9638743",
        "ListAgentMLSID": "228109",
        "ListingAgreementType": "Active-Exclusive Right",
        "ListOffice_MUI": "1004068",
        "ListOfficeMLSID": "BMCM",
        "ListOfficeName": "Griffin Group Realty",
        "ListOfficePhone": "702-479-0079",
        "ListPrice": "274900.00",
        "Litigation": "No",
        "NODDate": "",
        "NOI": "",
        "NumAcres": "0.0900",
        "NumberofFurnishedUnits": "",
        "NumberofPets": "",
        "NumBldgs": "",
        "NumDenOther": "0",
        "NumFloors": "",
        "NumGAcres": "",
        "NumLoft": "0",
        "NumofLoftAreas": "",
        "NumofParkingSpacesIncluded": "",
        "NumParcels": "",
        "NumParking": "",
        "NumStorageUnits": "",
        "NumTerraces": "",
        "NumUnits": "",
        "OffMarketDate": "2021-01-08",
        "OnSiteStaff": "",
        "OnSiteStaffIncludes": "",
        "OriginalEntryTimestamp": "2018-08-21T17:45:49.823",
        "OriginalListPrice": "319900.00",
        "OtherApplianceDescription": "None",
        "OtherDeposit": "",
        "OtherEncumbranceDesc": "",
        "OtherIncomeDescription": "",
        "OtherRefund": "",
        "OvenDescription": "Cooktop(G)",
        "OvenFuel": "",
        "OwnerLicensee": "Yes",
        "OwnerManaged": "",
        "Ownership": "",
        "OwnersName": "",
        "OwnerWillCarry": "",
        "PackageAvailable": "",
        "ParcelNumber": "138-16-815-048",
        "ParkingDescription": "",
        "ParkingLevel": "",
        "ParkingSpaceIDNum": "",
        "PavedRoad": "",
        "PendingDate": "2021-01-08",
        "PermittedPropertyManager": "",
        "PerPetYN": "",
        "PetDeposit": "",
        "PetDescription": "",
        "PetRefund": "",
        "PetsAllowed": "",
        "PhotoCount": "50",
        "PhotoExcluded": "",
        "PoolDescription": "",
        "PoolLength": "",
        "PoolWidth": "",
        "PostalCodePlus4": "",
        "PoweronorOff": "Power ON",
        "PreviousParcelNumber": "",
        "PriceChangeTimestamp": "2020-09-09T14:58:17.380",
        "PriceChgDate": ""
    },
    "price_changes": [
        {
            "set_at": "2021-03-15T23:39:31.9271481Z",
            "price": 274000.00,
            "delta": -3900.00
        }
    ],
    "amenities": null,
    "elementary_school": "Eisenberg Dorothy",
    "middle_school": "Eisenberg Dorothy",
    "jr_high_school": "Becker",
    "high_school": "Cimarron-Memorial",
    "deleted_at": null,
    "is_available": false,
    "is_unable_to_find_coordinates": false,
    "source": "abc"
}

Your content line need to be on a single line, just like the header.

1 Like