Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kevcodez/elasticsearch-java-transportclient-showcase

Sample code for Elasticsearch Java API
https://github.com/kevcodez/elasticsearch-java-transportclient-showcase

elasticsearch elasticsearch-api java

Last synced: 8 days ago
JSON representation

Sample code for Elasticsearch Java API

Awesome Lists containing this project

README

        

# Elasticsearch Java API

This repository contains code showing how to use the Elasticsearch API for Java.

## Setup

Download Elasticsearch from the official website
https://www.elastic.co/de/downloads/elasticsearch

Unzip the folder and navigate into bin.

Execute the elasticsearch.bat / elasticsearch.sh.

Run the de.kevcodez.elasticsearch.create.FillIndex class that generates a few thousand of orders and puts them into Elasticsearch.

You may now run de.kevcodez.elasticsearch.search.Aggregations or de.kevcodez.elasticsearch.search.BasicSearch.

### Create ElasticSearch Index

You need to create an index named orders.

`curl -X PUT localhost:9200/orders`

### Edit Host/Port

The de.kevcodez.elasticsearch.Client creates an Elasticsearch client with the default Port 9300 and host localhost.

### Lombok

This project uses Lombok, see http://projectlombok.org for reference.

## Further reading

Java API Overview: https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html