java.lang.Object
gov.nasa.pds.registry.common.es.dao.schema.SchemaDao

public class SchemaDao extends Object
Elasticsearch schema DAO (Data Access Object). This class provides methods to read and update Elasticsearch schema.
Author:
karpenko
  • Constructor Details

    • SchemaDao

      public SchemaDao(RestClient client, String indexName)
      Constructor
      Parameters:
      client - Elasticsearch client
      indexName - Elasticsearch index name
  • Method Details

    • getFieldNames

      public Set<String> getFieldNames() throws Exception
      Call Elasticsearch "mappings" API to get a list of field names.
      Returns:
      a collection of field names
      Throws:
      Exception - an exception
    • updateSchema

      public void updateSchema(List<Tuple> fields) throws Exception
      Add new fields to Elasticsearch schema.
      Parameters:
      fields - A list of fields to add. Each field tuple has a name and a data type.
      Throws:
      Exception - an exception