Class ElasticsearchTable

    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • AGGREGATIONS

        private static final java.lang.String AGGREGATIONS
        Used for constructing (possibly nested) Elastic aggregation nodes.
        See Also:
        Constant Field Values
      • indexName

        private final java.lang.String indexName
      • mapper

        final com.fasterxml.jackson.databind.ObjectMapper mapper
    • Constructor Detail

    • Method Detail

      • scriptedFieldPrefix

        java.lang.String scriptedFieldPrefix()
        In ES 5.x scripted fields start with params._source.foo while in ES2.x _source.foo. Helper method to build correct query based on runtime version of elastic. Used to keep backwards compatibility with ES2.
        Returns:
        string to be used for scripted fields
        See Also:
        _source variable, Scripted Fields
      • find

        private Enumerable<java.lang.Object> find​(java.util.List<java.lang.String> ops,
                                                  java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Class>> fields,
                                                  java.util.List<java.util.Map.Entry<java.lang.String,​RelFieldCollation.Direction>> sort,
                                                  java.util.List<java.lang.String> groupBy,
                                                  java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> aggregations,
                                                  java.util.Map<java.lang.String,​java.lang.String> mappings,
                                                  java.lang.Long offset,
                                                  java.lang.Long fetch)
                                           throws java.io.IOException
        Executes a "find" operation on the underlying index.
        Parameters:
        ops - List of operations represented as Json strings.
        fields - List of fields to project; or null to return map
        sort - list of fields to sort and their direction (asc/desc)
        aggregations - aggregation functions
        Returns:
        Enumerator of results
        Throws:
        java.io.IOException
      • aggregate

        private Enumerable<java.lang.Object> aggregate​(java.util.List<java.lang.String> ops,
                                                       java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.Class>> fields,
                                                       java.util.List<java.util.Map.Entry<java.lang.String,​RelFieldCollation.Direction>> sort,
                                                       java.util.List<java.lang.String> groupBy,
                                                       java.util.List<java.util.Map.Entry<java.lang.String,​java.lang.String>> aggregations,
                                                       java.util.Map<java.lang.String,​java.lang.String> mapping,
                                                       java.lang.Long offset,
                                                       java.lang.Long fetch)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • getRowType

        public RelDataType getRowType​(RelDataTypeFactory relDataTypeFactory)
        Description copied from interface: Table
        Returns this table's row type.

        This is a struct type whose fields describe the names and types of the columns in this table.

        The implementer must use the type factory provided. This ensures that the type is converted into a canonical form; other equal types in the same query will use the same object.

        Specified by:
        getRowType in interface Table
        Parameters:
        relDataTypeFactory - Type factory with which to create the type
        Returns:
        Row type
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object