public class EsClient extends Object
| Constructor and Description |
|---|
EsClient(String host,
int port)
Creates new instance.
|
| Modifier and Type | Method and Description |
|---|---|
long |
count(String name,
String type)
Counts entries.
|
boolean |
createIndex(String name,
String type,
EsRequest mappings)
Creates new index.
|
void |
deleteAll(String name,
String type)
Deletes all documents.
|
boolean |
deleteDocument(String name,
String type,
String id)
Deletes document.
|
boolean |
deleteIndex(String name)
Deletes index.
|
void |
flush(String name)
Flushes index data.
|
EsRequest |
getDocument(String name,
String type,
String id)
Searches indexed document.
|
boolean |
indexExists(String name)
Tests for the index existence with specified name.
|
void |
refresh(String name)
Refreshes index data.
|
EsResponse |
search(String name,
String type,
EsRequest query)
Executes query.
|
boolean |
storeDocument(String name,
String type,
String id,
EsRequest doc)
Indexes document.
|
public EsClient(String host, int port)
host - the address of the ES engine.port - the port number of ES engine.public boolean indexExists(String name) throws IOException
name - the name of the index to test.IOException - communication exception.public boolean createIndex(String name, String type, EsRequest mappings) throws IOException
name - the name of the index to test.type - index typemappings - field mapping definition.IOException - communication exception.public boolean deleteIndex(String name) throws IOException
name - the name of the index to be deleted.IOExceptionpublic boolean storeDocument(String name, String type, String id, EsRequest doc) throws IOException
name - the name of the index.type - index typeid - document iddoc - documentIOExceptionpublic EsRequest getDocument(String name, String type, String id) throws IOException
name - index name.type - index type.id - document identifier.IOExceptionpublic boolean deleteDocument(String name, String type, String id) throws IOException
name - index name.type - index type.id - document idIOExceptionpublic void deleteAll(String name, String type) throws IOException
name - index nametype - index type.IOExceptionpublic void flush(String name) throws IOException
name - index name.IOExceptionpublic void refresh(String name) throws IOException
name - index name.IOExceptionpublic EsResponse search(String name, String type, EsRequest query) throws IOException
name - index name.type - index type.query - query to be executedIOExceptionpublic long count(String name, String type) throws IOException
name - index name.type - index type.IOExceptionCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.