How to get all indexes from elasticsearch with spring-elastisearch?


Hi, I am new in elastic, I want to create java webservise to existing elasticsearch database. I need to use spring elasticsearch. I tryed to google it but everything what I found was just examples to create new one not to read data from existing one.

How should entity look like if I have JSON like this ? How can I get all indexes and data from them ?

JSON from Marvel

"_index": "theatre_2012-01-01",
    "_type": "mass",
    "_id": "32539",
    "_score": 1,
    "_source": {
       "control_id": "59",
       "valid": true,
       "start": 1325376900000,
       "raw": true,
       "end": 1325377800000,
       "value": 54,
       "tags": [

(David Pilato) #2

Spring elasticsearch project only gives you a way to create an Elasticsearch client and automatically creates indices and mappings.

But then you have to run yourself searches and read the data back JSON and then convert using Jackson or whatever.

May be Spring data elasticsearch is more something you are looking for?


So what do you recommend me to use to connection into the existing elasrtic database ? I tryed Spring Data Elasticsearch but it doesn't work.

(David Pilato) #4

What do you want to do?

I mean I thought you were looking for automatic object mapping but sounds like it's not the case.

Well, using spring elasticsearch project is fine then.

Once you have a Java Client just use it as explained in the elasticsearch guide / clients / Java API.

(system) #5