Adding Test Data

Published on January 17, 2016 by

Now that we have added mappings to our index, let’s add some test data to it so that we have some data to search in the remainder of the series. To do this, I will open up the terminal and issue an HTTP request with cURL, where I will be importing a JSON file. You can use any other tool that lets you issue an HTTP request and read a file from your hard drive.

If you wish, you can go ahead and download the test data if you want to follow along. The data is randomly generated so does not always make much sense, but it is good enough for your purposes.

Navigate to the directory containing the test data file in the terminal and run the below command or equivalent.

curl -XPOST 'http://localhost:9200/ecommerce/product/_bulk?pretty' --data-binary "@test-data.json"

Now you should see the test data being added. Once finished, we can make use of Kibana that we installed earlier. To do this, first navigate to http://localhost:5601/. If you are presented with a screen asking you to enter an index mapping, then you can enter either * (an asterisk) or ecommerce. Once this is done, navigate to the Discover tab, where you should see the newly added documents.

Author avatar
Bo Andersen

About the Author

I am a back-end web developer with a passion for open source technologies. I have been a PHP developer for many years, and also have experience with Java and Spring Framework. I currently work full time as a lead developer. Apart from that, I also spend time on making online courses, so be sure to check those out!

Leave a Reply

Your e-mail address will not be published.