public class ElasticsearchIndex extends AbstractSearchIndex
LuceneSail| Modifier and Type | Field and Description |
|---|---|
static String |
ALL_PROPERTY_FIELDS |
static String |
DEFAULT_ANALYZER |
static String |
DEFAULT_DOCUMENT_TYPE |
static String |
DEFAULT_INDEX_NAME |
static String |
DEFAULT_TRANSPORT |
static String |
DOCUMENT_TYPE_KEY
Set the parameter "documentType=" to specify the document type to use.
|
static String |
ELASTICSEARCH_KEY_PREFIX |
static String |
GEOPOINT_FIELD_PREFIX |
static String |
GEOSHAPE_FIELD_PREFIX |
static String |
INDEX_NAME_KEY
Set the parameter "indexName=" to specify the index to use.
|
static String |
PROPERTY_FIELD_PREFIX |
static String |
TRANSPORT_KEY
Set the parameter "transport=" to specify the address of the cluster to use (e.g.
|
static String |
WAIT_FOR_ACTIVE_SHARDS_KEY
Set the parameter "waitForActiveShards=" to configure if
initialization
should wait until the specified number of shards to be active. |
static String |
WAIT_FOR_NO_RELOCATING_SHARDS_KEY
Set the parameter "waitForNoRelocatingShards=true|false" to configure if
initialization should wait until the are no relocating shards. |
static String |
WAIT_FOR_NODES_KEY
Set the parameter "waitForNodes=" to configure if
initialization should
wait until the specified number of nodes are available. |
static String |
WAIT_FOR_RELOCATING_SHARDS_KEY
Deprecated.
use
WAIT_FOR_NO_RELOCATING_SHARDS_KEY in elastic search >= 5.x |
static String |
WAIT_FOR_STATUS_KEY
Set the parameter "waitForStatus=" to configure if
initialization
should wait for a particular health status. |
maxDocs, wktFields| Constructor and Description |
|---|
ElasticsearchIndex() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDocument(SearchDocument doc) |
void |
begin()
Begins a transaction.
|
void |
beginReading() |
void |
clear()
Clears the indexes.
|
void |
clearContexts(Resource... contexts)
This should be called from within a begin-commit-rollback block.
|
void |
commit()
Commits any changes done to the LuceneIndex since the last commit.The semantics is synchronous to
SailConnection.commit(), i.e.
|
protected SearchDocument |
copyDocument(SearchDocument doc) |
protected com.google.common.base.Function<? super String,? extends org.locationtech.spatial4j.context.SpatialContext> |
createSpatialContextMapper(Map<String,String> parameters) |
protected void |
deleteDocument(SearchDocument doc) |
void |
endReading() |
protected Iterable<? extends DocumentDistance> |
geoQuery(IRI geoProperty,
org.locationtech.spatial4j.shape.Point p,
IRI units,
double distance,
String distanceVar,
Var contextVar) |
protected Iterable<? extends DocumentResult> |
geoRelationQuery(String relation,
IRI geoProperty,
String wkt,
Var contextVar) |
String |
getClusterName() |
SearchDocument |
getDocument(Resource subject,
Resource context)
Returns a Document representing the specified Resource and Context combination, or null when no such Document
exists yet.
|
protected SearchDocument |
getDocument(String id)
Returns a Document representing the specified document ID (combination of resource and context), or null when no
such Document exists yet.
|
Iterable<? extends SearchDocument> |
getDocuments(Resource subject)
Returns a list of Documents representing the specified Resource (empty when no such Document exists yet).Each
document represent a set of statements with the specified Resource as a subject, which are stored in a specific
context
|
protected Iterable<? extends SearchDocument> |
getDocuments(String resourceId) |
String |
getIndexName() |
Map<String,Object> |
getMappings() |
static Set<String> |
getPropertyFields(Set<String> fields)
Filters the given list of fields, retaining all property fields.
|
protected org.locationtech.spatial4j.context.SpatialContext |
getSpatialContext(String property) |
String[] |
getTypes() |
void |
initialize(Properties parameters) |
protected BulkUpdater |
newBulkUpdate() |
protected SearchDocument |
newDocument(String id,
String resourceId,
String context) |
protected SearchQuery |
parseQuery(String query,
IRI propertyURI)
Deprecated.
|
protected Iterable<? extends DocumentScore> |
query(Resource subject,
String query,
IRI propertyURI,
boolean highlight)
Parse the passed query.
|
void |
rollback() |
org.elasticsearch.search.SearchHits |
search(Resource resource,
org.elasticsearch.action.search.SearchRequestBuilder request,
org.elasticsearch.index.query.QueryBuilder query)
Evaluates the given query only for the given resource.
|
org.elasticsearch.search.SearchHits |
search(org.elasticsearch.action.search.SearchRequestBuilder request,
org.elasticsearch.index.query.QueryBuilder query)
Evaluates the given query and returns the results as a TopDocs instance.
|
void |
shutDown() |
protected void |
updateDocument(SearchDocument doc) |
accept, addDocuments, addRemoveStatements, addStatement, evaluate, evaluate, getResource, isGeoField, parseLuceneQueryShape, parseQueryPoint, parseQueryShape, removeStatementpublic static final String INDEX_NAME_KEY
public static final String DOCUMENT_TYPE_KEY
public static final String TRANSPORT_KEY
public static final String WAIT_FOR_STATUS_KEY
initialization
should wait for a particular health status. The value can be one of "green" or "yellow". Does not wait by
default.public static final String WAIT_FOR_NODES_KEY
initialization should
wait until the specified number of nodes are available. Does not wait by default.public static final String WAIT_FOR_ACTIVE_SHARDS_KEY
initialization
should wait until the specified number of shards to be active. Does not wait by default.@Deprecated public static final String WAIT_FOR_RELOCATING_SHARDS_KEY
WAIT_FOR_NO_RELOCATING_SHARDS_KEY in elastic search >= 5.xinitialization should wait until the specified number of nodes are relocating. Does not wait by default.public static final String WAIT_FOR_NO_RELOCATING_SHARDS_KEY
initialization should wait until the are no relocating shards. Defaults to false, meaning the operation does not
wait on there being no more relocating shards. Set to true to wait until the number of relocating shards in the
cluster is 0.public static final String DEFAULT_INDEX_NAME
public static final String DEFAULT_DOCUMENT_TYPE
public static final String DEFAULT_TRANSPORT
public static final String DEFAULT_ANALYZER
public static final String ELASTICSEARCH_KEY_PREFIX
public static final String PROPERTY_FIELD_PREFIX
public static final String ALL_PROPERTY_FIELDS
public static final String GEOPOINT_FIELD_PREFIX
public static final String GEOSHAPE_FIELD_PREFIX
public String getClusterName()
public String getIndexName()
public String[] getTypes()
public void initialize(Properties parameters) throws Exception
initialize in interface SearchIndexinitialize in class AbstractSearchIndexExceptionprotected com.google.common.base.Function<? super String,? extends org.locationtech.spatial4j.context.SpatialContext> createSpatialContextMapper(Map<String,String> parameters)
public Map<String,Object> getMappings() throws IOException
IOExceptionprotected org.locationtech.spatial4j.context.SpatialContext getSpatialContext(String property)
getSpatialContext in class AbstractSearchIndexpublic void shutDown()
throws IOException
IOExceptionprotected SearchDocument getDocument(String id) throws IOException
getDocument in class AbstractSearchIndexIOExceptionprotected Iterable<? extends SearchDocument> getDocuments(String resourceId) throws IOException
getDocuments in class AbstractSearchIndexIOExceptionprotected SearchDocument newDocument(String id, String resourceId, String context)
newDocument in class AbstractSearchIndexprotected SearchDocument copyDocument(SearchDocument doc)
copyDocument in class AbstractSearchIndexprotected void addDocument(SearchDocument doc) throws IOException
addDocument in class AbstractSearchIndexIOExceptionprotected void updateDocument(SearchDocument doc) throws IOException
updateDocument in class AbstractSearchIndexIOExceptionprotected void deleteDocument(SearchDocument doc) throws IOException
deleteDocument in class AbstractSearchIndexIOExceptionprotected BulkUpdater newBulkUpdate()
newBulkUpdate in class AbstractSearchIndexpublic SearchDocument getDocument(Resource subject, Resource context) throws IOException
subject - context - IOExceptionpublic Iterable<? extends SearchDocument> getDocuments(Resource subject) throws IOException
subject - IOExceptionpublic static Set<String> getPropertyFields(Set<String> fields)
fields - public void begin()
throws IOException
SearchIndexIOExceptionpublic void commit()
throws IOException
SearchIndexIOExceptionpublic void rollback()
throws IOException
IOExceptionpublic void beginReading()
throws IOException
IOExceptionpublic void endReading()
throws IOException
IOException@Deprecated protected SearchQuery parseQuery(String query, IRI propertyURI) throws MalformedQueryException
parseQuery in class AbstractSearchIndexquery - stringParseException - when the parsing brakesMalformedQueryExceptionprotected Iterable<? extends DocumentScore> query(Resource subject, String query, IRI propertyURI, boolean highlight) throws MalformedQueryException, IOException
query in class AbstractSearchIndexsubject - query - stringpropertyURI - highlight - ParseException - when the parsing brakesIOExceptionMalformedQueryExceptionpublic org.elasticsearch.search.SearchHits search(Resource resource, org.elasticsearch.action.search.SearchRequestBuilder request, org.elasticsearch.index.query.QueryBuilder query)
resource - request - query - protected Iterable<? extends DocumentDistance> geoQuery(IRI geoProperty, org.locationtech.spatial4j.shape.Point p, IRI units, double distance, String distanceVar, Var contextVar) throws MalformedQueryException, IOException
geoQuery in class AbstractSearchIndexMalformedQueryExceptionIOExceptionprotected Iterable<? extends DocumentResult> geoRelationQuery(String relation, IRI geoProperty, String wkt, Var contextVar) throws MalformedQueryException, IOException
geoRelationQuery in class AbstractSearchIndexMalformedQueryExceptionIOExceptionpublic org.elasticsearch.search.SearchHits search(org.elasticsearch.action.search.SearchRequestBuilder request,
org.elasticsearch.index.query.QueryBuilder query)
public void clearContexts(Resource... contexts) throws IOException
SearchIndexcontexts - IOExceptionpublic void clear()
throws IOException
SearchIndexIOExceptionCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.