Publishing Bulk Content To ElasticSearch using cURL
Elasticsearch is one of the key players in the enterprise search engine technologies. Integrates seamlessly and operates on JSON format which is is easily consumable by the client apps available. Is schema-less and gives you more control to structure your data.
One of the key requirements come in when you want to publish data in bulk since your databases are already full of data and text based search is pushing your database which could serve other requests than just text based search.
We will talk about the publish API today, using cURL since there are cases when you have the data and you want to play around by publishing data to elasticseach.
We recommend creating a index first , create it with
One the index is ready , you can create your json content . In this example, we will be using a standard json array file and convert it to elastic format. Below is our sample data
Now , elasticsearch would not be taking the same format, so we will be transforming the data and pushing it to elastic search. We will be using JQ to transform the content . Install JQ on your machine.
The above script reads your json, transforms using jq and then publishes the content from your file to elasticsearch. We are doing echo at the end to print the response from bulk request.