i have document in ElasticSearch
{
"uuid" : 0,
"StatusHistoryList" : [
{
"ArtWorkDate" : "2015-08-25T16:29:32.011+05:00",
"ArtworkStatus" : "ACTIVE"
}
]
}
i am adding this via code but having problem in adding this array field StatusHistoryList
i am doing it like this
var xb:XContentBuilder=XContentFactory.jsonBuilder().startObject()
.field("uuid",artWork.getUuid)
xb.startArray("StatusHistoryList")
for(h<-history)
{
var date=h.date.toString()
var artworkStatus=h.artworkStatus.toString
xb.startObject()
xb.field("ArtWorkDate",date)
xb.field("ArtworkStatus",artworkStatus)
xb.endObject()
}
xb.endArray()
xb.endObject()
val bulkRequest=client.prepareBulk()
bulkRequest.add(client.prepareIndex("arteciatedb","artWork",artWork.uuid.toString())
.setSource(xb)
)
val bulkResponse =bulkRequest.execute().actionGet()
if(bulkResponse.hasFailures())
{
log.error("something is wrong here ")
}}
on the console it is printing something is wrong here
please help me where i am doing it wrong
UPDATE after the answer by Nimo here is the output printed on console
controller ERROR - failed to executefailure in bulk execution:
[0]: index [arteciatedb], type [artWork], id [0], message [MapperParsingException[failed to parse [StatusHistoryList]]; nested: ElasticsearchIllegalArgumentException[unknown property [ArtWorkDate]]; ]
bulkResponse?