Interface IndexSchemaManager


public interface IndexSchemaManager
A manager for the schema of a single index, i.e. the data structure in which index data is stored. It includes the core index files, but also any additional configuration required by the backend such as field metadata or analyzer definitions.

A schema has to be created before indexing and searching can happen.

A schema can become obsolete, in which case it needs to be updated (not always possible) or re-created (will drop any indexed data).

  • Method Details

    • createIfMissing

      CompletableFuture<?> createIfMissing(OperationSubmitter operationSubmitter)
      Creates the schema if it doesn't already exist.

      Does not change or validate anything if the schema already exists.

      Parameters:
      operationSubmitter - How to handle request to submit operation when the queue is full.
      Returns:
      A future.
    • createOrValidate

      CompletableFuture<?> createOrValidate(ContextualFailureCollector failureCollector, OperationSubmitter operationSubmitter)
      Creates the schema if it doesn't already exist, or validates the existing schema against requirements expressed by the mapper.

      If the schema exists and validation happens, validation failures do not trigger an exception, but instead are pushed to the given collector.

      Parameters:
      failureCollector - A collector for validation failures.
      operationSubmitter - How to handle request to submit operation when the queue is full.
      Returns:
      A future.
    • createOrUpdate

      CompletableFuture<?> createOrUpdate(OperationSubmitter operationSubmitter)
      Creates the schema if it doesn't already exist, or updates the existing schema to match requirements expressed by the mapper.

      Updating the schema may be impossible (for example if the type of a field changed). In this case, the future will ultimately be completed with a SearchException.

      Parameters:
      operationSubmitter - How to handle request to submit operation when the queue is full.
      Returns:
      A future.
    • dropIfExisting

      CompletableFuture<?> dropIfExisting(OperationSubmitter operationSubmitter)
      Drops the schema and all indexed data if it exists.

      Does not change anything if the schema does not exist.

      Parameters:
      operationSubmitter - How to handle request to submit operation when the queue is full.
      Returns:
      A future.
    • dropAndCreate

      CompletableFuture<?> dropAndCreate(OperationSubmitter operationSubmitter)
      Drops the schema and all indexed data if it exists, then creates the schema.
      Parameters:
      operationSubmitter - How to handle request to submit operation when the queue is full.
      Returns:
      A future.
    • validate

      CompletableFuture<?> validate(ContextualFailureCollector failureCollector, OperationSubmitter operationSubmitter)
      Validates the existing schema against requirements expressed by the mapper.

      If the schema does not exist, a failure is pushed to the given collector.

      If the index exists and validation happens, validation failures do not trigger an exception, but instead are pushed to the given collector.

      Parameters:
      failureCollector - A collector for validation failures.
      operationSubmitter - How to handle request to submit operation when the queue is full.
      Returns:
      A future.
    • exportExpectedSchema

      @Incubating void exportExpectedSchema(IndexSchemaCollector collector)
      Accepts a collector that will receive the schema export represented by this index schema manager.