Class ElasticsearchSchema

  • All Implemented Interfaces:
    Schema

    public class ElasticsearchSchema
    extends AbstractSchema
    Each table in the schema is an ELASTICSEARCH index.
    • Field Detail

      • client

        private final org.elasticsearch.client.RestClient client
      • mapper

        private final com.fasterxml.jackson.databind.ObjectMapper mapper
      • tableMap

        private final java.util.Map<java.lang.String,​Table> tableMap
      • fetchSize

        private final int fetchSize
        Default batch size to be used during scrolling.
    • Constructor Detail

      • ElasticsearchSchema

        public ElasticsearchSchema​(org.elasticsearch.client.RestClient client,
                                   com.fasterxml.jackson.databind.ObjectMapper mapper,
                                   java.lang.String index)
        Allows schema to be instantiated from existing elastic search client.
        Parameters:
        client - existing client instance
        mapper - mapper for JSON (de)serialization
        index - name of ES index
      • ElasticsearchSchema

        ElasticsearchSchema​(org.elasticsearch.client.RestClient client,
                            com.fasterxml.jackson.databind.ObjectMapper mapper,
                            java.lang.String index,
                            int fetchSize)
    • Method Detail

      • createTables

        private java.util.Map<java.lang.String,​Table> createTables​(java.lang.Iterable<java.lang.String> indices)
      • indicesFromElastic

        private java.util.Set<java.lang.String> indicesFromElastic()
                                                            throws java.io.IOException
        Queries _alias definition to automatically detect all indices
        Returns:
        list of indices
        Throws:
        java.io.IOException - for any IO related issues
        java.lang.IllegalStateException - if reply is not understood