Help with ElasticSearch Bulk index api

Hello --

This may be an obvious fix so I apologize as I am very new to the Elastic Search platform but I am attempting to use the Elastic Search Bulk API to index some data but am running into issues. Please find what I am attempting below:

curl -H 'Content-Type: application/json' -XPOST http://localhost:9200/products/demo/_bulk --data-binary @/usr/share/elasticsearch/bulk-test2.json

Error Message:

{"error":{"root_cause":[{"type":"json_parse_exception","reason":"Unrecognized token 'me': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@16ce447b; line: 1, column: 4]"}],"type":"json_parse_exception","reason":"Unrecognized token 'me': was expecting ('true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@16ce447b; line: 1, column: 4]"},"status":500}[root@es-demo-6d544bc556-k5fjt elasticsearch]#

The bulk-test2.json data looks like this -- it is sample data from Best Buy that I am using as a test index for Elastic Search:

{"index":{}}
{"sku":43900,"name":"Duracell - AAA Batteries (4-Pack)","type":"HardGood","price":5.49,"upc":"041333424019","category":[{"id":"pcmcat312300050015","name":"Connected Home & Housewares"},{"id":"pcmcat248700050021","name":"Housewares"},{"id":"pcmcat303600050001","name":"Household Batteries"},{"id":"abcat0208002","name":"Alkaline Batteries"}],"shipping":5.49,"description":"Compatible with select electronic devices; AAA size; DURALOCK Power Preserve technology; 4-pack","manufacturer":"Duracell","model":"MN2400B4Z","url":"http://www.bestbuy.com/site/duracell-aaa-batteries-4-pack/43900.p?id=1051384074145&skuId=43900&cmp=RMXCC","image":"http://img.bbystatic.com/BestBuy_US/images/products/4390/43900_sa.jpg"}
{"index":{}}
{"sku":48530,"name":"Duracell - AA 1.5V CopperTop Batteries (4-Pack)","type":"HardGood","price":5.49,"upc":"041333415017","category":[{"id":"pcmcat312300050015","name":"Connected Home & Housewares"},{"id":"pcmcat248700050021","name":"Housewares"},{"id":"pcmcat303600050001","name":"Household Batteries"},{"id":"abcat0208002","name":"Alkaline Batteries"}],"shipping":5.49,"description":"Long-lasting energy; DURALOCK Power Preserve technology; for toys, clocks, radios, games, remotes, PDAs and more","manufacturer":"Duracell","model":"MN1500B4Z","url":"http://www.bestbuy.com/site/duracell-aa-1-5v-coppertop-batteries-4-pack/48530.p?id=1099385268988&skuId=48530&cmp=RMXCC","image":"http://img.bbystatic.com/BestBuy_US/images/products/4853/48530_sa.jpg"}

Any help would be greatly appreciated and thank you!!

I was trying to reproduce the issue with the date that you have provided, but everything works fine here. Is it possible that you bulk-test2.json file contains some symbols that were not posted in the forum correctly?

Igor --

Thank you for the response. You were absolutely right -- I was missing a single { from my original file. This is why a second set of eyes is always a good idea.

Thank you so much for taking the time to test this and confirming -- I was starting to go a little crazy.

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