Class IndicesTemplate

java.lang.Object
org.springframework.data.elasticsearch.client.elc.ChildTemplate<co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient>
org.springframework.data.elasticsearch.client.elc.IndicesTemplate
All Implemented Interfaces:
IndexOperations

public class IndicesTemplate extends ChildTemplate<co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient> implements IndexOperations
Implementation of the IndexOperations interface using en ElasticsearchIndicesClient.
Since:
4.4
Author:
Peter-Josef Meisch
  • Field Details

  • Constructor Details

    • IndicesTemplate

      public IndicesTemplate(co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient client, ElasticsearchConverter elasticsearchConverter, Class<?> boundClass)
    • IndicesTemplate

      public IndicesTemplate(co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient client, ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex)
  • Method Details

    • checkForBoundClass

      protected Class<?> checkForBoundClass()
    • create

      public boolean create()
      Description copied from interface: IndexOperations
      Create an index.
      Specified by:
      create in interface IndexOperations
      Returns:
      true if the index was created
    • create

      public boolean create(Map<String,Object> settings)
      Description copied from interface: IndexOperations
      Create an index for given settings.
      Specified by:
      create in interface IndexOperations
      Parameters:
      settings - the index settings
      Returns:
      true if the index was created
    • create

      public boolean create(Map<String,Object> settings, Document mapping)
      Description copied from interface: IndexOperations
      Create an index for given settings and mapping.
      Specified by:
      create in interface IndexOperations
      Parameters:
      settings - the index settings
      mapping - the index mapping
      Returns:
      true if the index was created
    • createWithMapping

      public boolean createWithMapping()
      Description copied from interface: IndexOperations
      Create an index with the settings and mapping defined for the entity this IndexOperations is bound to.
      Specified by:
      createWithMapping in interface IndexOperations
      Returns:
      true if the index was created
    • doCreate

      protected boolean doCreate(IndexCoordinates indexCoordinates, Map<String,Object> settings, @Nullable Document mapping)
    • delete

      public boolean delete()
      Description copied from interface: IndexOperations
      Deletes the index this IndexOperations is bound to
      Specified by:
      delete in interface IndexOperations
      Returns:
      true if the index was deleted
    • exists

      public boolean exists()
      Description copied from interface: IndexOperations
      Checks if the index this IndexOperations is bound to exists
      Specified by:
      exists in interface IndexOperations
      Returns:
      true if the index exists
    • refresh

      public void refresh()
      Description copied from interface: IndexOperations
      Refresh the index(es) this IndexOperations is bound to
      Specified by:
      refresh in interface IndexOperations
    • createMapping

      public Document createMapping()
      Description copied from interface: IndexOperations
      Creates the index mapping for the entity this IndexOperations is bound to.
      Specified by:
      createMapping in interface IndexOperations
      Returns:
      mapping object
    • createMapping

      public Document createMapping(Class<?> clazz)
      Description copied from interface: IndexOperations
      Creates the index mapping for the given class
      Specified by:
      createMapping in interface IndexOperations
      Parameters:
      clazz - the clazz to create a mapping for
      Returns:
      mapping object
    • putMapping

      public boolean putMapping(Document mapping)
      Description copied from interface: IndexOperations
      writes a mapping to the index
      Specified by:
      putMapping in interface IndexOperations
      Parameters:
      mapping - the Document with the mapping definitions
      Returns:
      true if the mapping could be stored
    • getMapping

      public Map<String,Object> getMapping()
      Description copied from interface: IndexOperations
      Get mapping for an index defined by a class.
      Specified by:
      getMapping in interface IndexOperations
      Returns:
      the mapping
    • createSettings

      public Settings createSettings()
      Description copied from interface: IndexOperations
      Creates the index settings for the entity this IndexOperations is bound to.
      Specified by:
      createSettings in interface IndexOperations
      Returns:
      a settings document.
    • createSettings

      public Settings createSettings(Class<?> clazz)
      Description copied from interface: IndexOperations
      Creates the index settings from the annotations on the given class
      Specified by:
      createSettings in interface IndexOperations
      Parameters:
      clazz - the class to create the index settings from
      Returns:
      a settings document.
    • getSettings

      public Settings getSettings()
      Description copied from interface: IndexOperations
      Get the index settings.
      Specified by:
      getSettings in interface IndexOperations
      Returns:
      the settings
    • getSettings

      public Settings getSettings(boolean includeDefaults)
      Description copied from interface: IndexOperations
      Get the index settings.
      Specified by:
      getSettings in interface IndexOperations
      Parameters:
      includeDefaults - whether or not to include all the default settings
      Returns:
      the settings
    • alias

      public boolean alias(AliasActions aliasActions)
      Description copied from interface: IndexOperations
      Executes the given AliasActions.
      Specified by:
      alias in interface IndexOperations
      Parameters:
      aliasActions - the actions to execute
      Returns:
      if the operation is acknowledged by Elasticsearch
    • getAliases

      public Map<String,Set<AliasData>> getAliases(String... aliasNames)
      Description copied from interface: IndexOperations
      gets information about aliases
      Specified by:
      getAliases in interface IndexOperations
      Parameters:
      aliasNames - alias names, must not be null
      Returns:
      a Map from index names to AliasData for that index
    • getAliasesForIndex

      public Map<String,Set<AliasData>> getAliasesForIndex(String... indexNames)
      Description copied from interface: IndexOperations
      gets information about aliases
      Specified by:
      getAliasesForIndex in interface IndexOperations
      Parameters:
      indexNames - index names, must not be null
      Returns:
      a Map from index names to AliasData for that index
    • putTemplate

      public boolean putTemplate(PutTemplateRequest putTemplateRequest)
      Description copied from interface: IndexOperations
      Creates an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).
      Specified by:
      putTemplate in interface IndexOperations
      Parameters:
      putTemplateRequest - template request parameters
      Returns:
      true if successful
    • getTemplate

      public TemplateData getTemplate(GetTemplateRequest getTemplateRequest)
      Description copied from interface: IndexOperations
      gets an index template using the legacy Elasticsearch interface.
      Specified by:
      getTemplate in interface IndexOperations
      Parameters:
      getTemplateRequest - the request parameters
      Returns:
      TemplateData, null if no template with the given name exists.
    • existsTemplate

      public boolean existsTemplate(ExistsTemplateRequest existsTemplateRequest)
      Description copied from interface: IndexOperations
      check if an index template exists using the legacy Elasticsearch interface.
      Specified by:
      existsTemplate in interface IndexOperations
      Parameters:
      existsTemplateRequest - the request parameters
      Returns:
      true if the index exists
    • deleteTemplate

      public boolean deleteTemplate(DeleteTemplateRequest deleteTemplateRequest)
      Description copied from interface: IndexOperations
      Deletes an index template using the legacy Elasticsearch interface (@see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates-v1.html).
      Specified by:
      deleteTemplate in interface IndexOperations
      Parameters:
      deleteTemplateRequest - template request parameters
      Returns:
      true if successful
    • getInformation

      public List<IndexInformation> getInformation(IndexCoordinates indexCoordinates)
      Description copied from interface: IndexOperations
      Gets the IndexInformation for the indices defined by #index.
      Specified by:
      getInformation in interface IndexOperations
      Parameters:
      indexCoordinates - defines the index names to get the information for
      Returns:
      a list of IndexInformation
    • getIndexCoordinates

      public IndexCoordinates getIndexCoordinates()
      Description copied from interface: IndexOperations
      get the current IndexCoordinates. These may change over time when the entity class has a SpEL constructed index name. When this IndexOperations is not bound to a class, the bound IndexCoordinates are returned.
      Specified by:
      getIndexCoordinates in interface IndexOperations
      Returns:
      IndexCoordinates
    • getIndexCoordinatesFor

      public IndexCoordinates getIndexCoordinatesFor(Class<?> clazz)