The following are the steps to get Elasticsearch ready with test data:
- Install the Elastic version. Use version 2.4.3, since the recent 5.1 versions are not compatible with Spring Data. Spring Data uses Java drivers that communicate on port 9300 with the server, and hence having the same version on the client and server is important.
- Create a test file with our sample data (similar to products.json). The format is only slightly different from the previous case, but for Elasticsearch instead of MongoDB. The products.json file is as follows:
{"index":{"_id":"1"}} {"id":"1","name":"Apples","catId":1} {"index":{"_id":"2"}} {"id":"2","name":"Oranges","catId":1} {"index":{"_id":"3"}} {"id":"3","name":"Bananas","catId":1} ...