Getting Error While trying to Upload Shakespeare.json


(shrey Agrawal) #1

I am trying to upload shakespeare.json using
curl -XPOST -H "Content-Type:application/json" "http://localhost:9200/shakespeare/_bulk?pretty" --data-binary @shakespeare.json

But i am getting the error as
{
"error" : {
"root_cause" : [
{
"type" : "action_request_validation_exception",
"reason" : "Validation Failed: 1: type is missing;2: type is missing;"
}
],
"type" : "action_request_validation_exception",
"reason" : "Validation Failed: 1: type is missing;2: type is missing;"
},
"status" : 400
}

I have downloaded the file which looks like:
{"index":{"_index":"shakespeare","_id":0}}
{"type":"act","line_id":1,"play_name":"Henry IV", "speech_number":"","line_number":"","speaker":"","text_entry":"ACT I"}
{"index":{"_index":"shakespeare","_id":1}}
{"type":"scene","line_id":2,"play_name":"Henry IV","speech_number":"","line_number":"","speaker":"","text_entry":"SCENE I. London. The palace."}
{"index":{"_index":"shakespeare","_id":2}}
{"type":"line","line_id":3,"play_name":"Henry IV","speech_number":"","line_number":"","speaker":"","text_entry":"Enter KING HENRY, LORD JOHN OF LANCASTER, the EARL of WESTMORELAND, SIR WALTER BLUNT, and others"}
{"index":{"_index":"shakespeare","_id":3}}
{"type":"line","line_id":4,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.1","speaker":"KING HENRY IV","text_entry":"So shaken as we are, so wan with care,"}

I have added Index as
PUT /shakespeare
{
"mappings": {
"doc": {
"properties": {
"speaker": {"type": "keyword"},
"play_name": {"type": "keyword"},
"line_id": {"type": "integer"},
"speech_number": {"type": "integer"}
}
}
}
}

Can anyone suggest where i am going wrong


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.