Class ElasticSearchRestDataContext
- java.lang.Object
-
- org.apache.metamodel.AbstractDataContext
-
- org.apache.metamodel.QueryPostprocessDataContext
-
- org.apache.metamodel.elasticsearch.AbstractElasticSearchDataContext
-
- org.apache.metamodel.elasticsearch.rest.ElasticSearchRestDataContext
-
- All Implemented Interfaces:
org.apache.metamodel.convert.HasReadTypeConverters,org.apache.metamodel.DataContext,org.apache.metamodel.UpdateableDataContext
public class ElasticSearchRestDataContext extends org.apache.metamodel.elasticsearch.AbstractElasticSearchDataContextDataContext implementation for ElasticSearch analytics engine. ElasticSearch has a data storage structure hierarchy that briefly goes like this:- Index
- Document type (short: Type) (within an index)
- Documents (of a particular type)
SimpleTableDefclass.
-
-
Constructor Summary
Constructors Constructor Description ElasticSearchRestDataContext(ElasticSearchRestClient client, String indexName)Constructs aElasticSearchRestDataContextand automatically detects the schema structure/view on an index.ElasticSearchRestDataContext(ElasticSearchRestClient client, String indexName, org.apache.metamodel.util.SimpleTableDef... tableDefinitions)Constructs aElasticSearchRestDataContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.metamodel.util.SimpleTableDef[]detectSchema()protected NumberexecuteCountQuery(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.query.FilterItem> whereItems, boolean functionApproximationAllowed)protected org.apache.metamodel.data.RowexecutePrimaryKeyLookupQuery(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.query.SelectItem> selectItems, org.apache.metamodel.schema.Column primaryKeyColumn, Object keyValue)org.apache.metamodel.UpdateSummaryexecuteUpdate(org.apache.metamodel.UpdateScript update)ElasticSearchRestClientgetElasticSearchClient()Gets theElasticSearchRestClientthat thisDataContextis wrapping.protected org.apache.metamodel.data.DataSetmaterializeMainSchemaTable(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.query.SelectItem> selectItems, List<org.apache.metamodel.query.FilterItem> whereItems, int firstRow, int maxRows)protected org.apache.metamodel.data.DataSetmaterializeMainSchemaTable(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.schema.Column> columns, int maxRows)protected voidonSchemaCacheRefreshed()-
Methods inherited from class org.apache.metamodel.elasticsearch.AbstractElasticSearchDataContext
getIndexName, getMainSchema, getMainSchemaName, limitMaxRowsIsSet, sortTables
-
Methods inherited from class org.apache.metamodel.QueryPostprocessDataContext
addConverter, executeQuery, getDefaultSchemaName, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, isScalarFunctionMaterialized, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTableSelect, materializeTable
-
Methods inherited from class org.apache.metamodel.AbstractDataContext
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, parseQuery, query, refreshSchemas
-
-
-
-
Constructor Detail
-
ElasticSearchRestDataContext
public ElasticSearchRestDataContext(ElasticSearchRestClient client, String indexName, org.apache.metamodel.util.SimpleTableDef... tableDefinitions)
Constructs aElasticSearchRestDataContext. This constructor accepts a custom array ofSimpleTableDefs which allows the user to define his own view on the indexes in the engine.- Parameters:
client- the ElasticSearch clientindexName- the name of the ElasticSearch index to representtableDefinitions- an array ofSimpleTableDefs, which define the table and column model of the ElasticSearch index.
-
ElasticSearchRestDataContext
public ElasticSearchRestDataContext(ElasticSearchRestClient client, String indexName)
Constructs aElasticSearchRestDataContextand automatically detects the schema structure/view on an index.- Parameters:
client- the ElasticSearch clientindexName- the name of the ElasticSearch index to represent
-
-
Method Detail
-
detectSchema
protected org.apache.metamodel.util.SimpleTableDef[] detectSchema()
- Specified by:
detectSchemain classorg.apache.metamodel.elasticsearch.AbstractElasticSearchDataContext
-
onSchemaCacheRefreshed
protected void onSchemaCacheRefreshed()
- Overrides:
onSchemaCacheRefreshedin classorg.apache.metamodel.AbstractDataContext
-
materializeMainSchemaTable
protected org.apache.metamodel.data.DataSet materializeMainSchemaTable(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.query.SelectItem> selectItems, List<org.apache.metamodel.query.FilterItem> whereItems, int firstRow, int maxRows)- Overrides:
materializeMainSchemaTablein classorg.apache.metamodel.QueryPostprocessDataContext
-
materializeMainSchemaTable
protected org.apache.metamodel.data.DataSet materializeMainSchemaTable(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.schema.Column> columns, int maxRows)- Specified by:
materializeMainSchemaTablein classorg.apache.metamodel.QueryPostprocessDataContext
-
executePrimaryKeyLookupQuery
protected org.apache.metamodel.data.Row executePrimaryKeyLookupQuery(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.query.SelectItem> selectItems, org.apache.metamodel.schema.Column primaryKeyColumn, Object keyValue)- Overrides:
executePrimaryKeyLookupQueryin classorg.apache.metamodel.QueryPostprocessDataContext
-
executeCountQuery
protected Number executeCountQuery(org.apache.metamodel.schema.Table table, List<org.apache.metamodel.query.FilterItem> whereItems, boolean functionApproximationAllowed)
- Overrides:
executeCountQueryin classorg.apache.metamodel.QueryPostprocessDataContext
-
executeUpdate
public org.apache.metamodel.UpdateSummary executeUpdate(org.apache.metamodel.UpdateScript update)
-
getElasticSearchClient
public ElasticSearchRestClient getElasticSearchClient()
Gets theElasticSearchRestClientthat thisDataContextis wrapping.
-
-