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.IOException
public boolean storeDocument(String name, String type, String id, EsRequest doc) throws IOException
name
- the name of the index.type
- index typeid
- document iddoc
- documentIOException
public EsRequest getDocument(String name, String type, String id) throws IOException
name
- index name.type
- index type.id
- document identifier.IOException
public boolean deleteDocument(String name, String type, String id) throws IOException
name
- index name.type
- index type.id
- document idIOException
public void deleteAll(String name, String type) throws IOException
name
- index nametype
- index type.IOException
public void flush(String name) throws IOException
name
- index name.IOException
public void refresh(String name) throws IOException
name
- index name.IOException
public EsResponse search(String name, String type, EsRequest query) throws IOException
name
- index name.type
- index type.query
- query to be executedIOException
public long count(String name, String type) throws IOException
name
- index name.type
- index type.IOException
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.