Sample Data bank does not work

Hi

First time user of elasticsearch - I have attempted to download the sample data from Sample Data, in particular, the bank sample data. The syntax to add the mapping for the bank data (which is missing) is as follows

{
 "mappings" : {
  "_default_" : {
   "properties" : {
"account_number" : {"type": "integer", "index" : "not_analyzed" },
"balance" : {"type": "integer", "index" : "not_analyzed" },
"firstname" : {"type": "string", "index" : "not_analyzed" },
"lastname" : {"type": "string", "index" : "not_analyzed" },
"age" : {"type": "integer", "index" : "not_analyzed" },
"gender" : {"type": "string", "index" : "not_analyzed" },
"address" : {"type": "string", "index" : "not_analyzed" },
"employer" : {"type": "string", "index" : "not_analyzed" },
"email" : {"type": "string", "index" : "not_analyzed" },
"city" : {"type": "string", "index" : "not_analyzed" },
"state" : {"type": "string", "index" : "not_analyzed" }
   }
  }
 }
}

However when I attempt to add in the sample data via postman at localhost:9200/bank/_bulk

I get the following error

{
  "error": {
    "root_cause": [
      {
        "type": "action_request_validation_exception",
        "reason": "Validation Failed: 1: type is missing;2: type is missing;3: type is missing;4: type is missing;5: type is missing;6: type is missing;7: type is missing;8: type is missing;9: type is missing;10: type is missing;11: type is missing;12: type is missing;13: type is missing;14: type is missing;15: 

Any ideas? Thanks

Here is an example on how to define a mapping: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/indices-put-mapping.html

Hi

Thanks for the reply and assistance.

I fixed up my index so it looks something like this
{
"properties" : {
"account" : {
"account_number" : {"type": "integer", "index" : "not_analyzed" },
"balance" : {"type": "integer", "index" : "not_analyzed" },
"firstname" : {"type": "string", "index" : "not_analyzed" },
"lastname" : {"type": "string", "index" : "not_analyzed" },
"age" : {"type": "integer", "index" : "not_analyzed" },
"gender" : {"type": "string", "index" : "not_analyzed" },
"address" : {"type": "string", "index" : "not_analyzed" },
"employer" : {"type": "string", "index" : "not_analyzed" },
"email" : {"type": "string", "index" : "not_analyzed" },
"city" : {"type": "string", "index" : "not_analyzed" },
"state" : {"type": "string", "index" : "not_analyzed" }
}
}
}

I also fixed up the json file so it looks something like this

{"index":{"_index":"bank","_type":"line","_id":1}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_index":"bank","_type":"line","_id":6}}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}

I am getting an error of
"type": "json_parse_exception",
"reason": "Unexpected character ('"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@1528955b; line: 1, column: 52]"

Please point me in the right direction. I'll admit I had not read all the documentation. :slight_smile:

Found my error - should have posted to localhost:9200/bank/account/_bulk?pretty

Thanks for your help. On my way :slight_smile:

1 Like

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