Interface IndexDefinition


public interface IndexDefinition
Definition for an index.
  • Method Details

    • getLabels

      Iterable<Label> getLabels()
      Return the set of node labels (in no particular order) that this index applies to. This method works for both multi-token indexes, and "single-token" indexes.

      Note that this assumes that this is a node index (that isNodeIndex() returns true). If this is not the case, then an IllegalStateException is thrown.

      Returns:
      the set of labels this index definition is associated with.
    • getRelationshipTypes

      Iterable<RelationshipType> getRelationshipTypes()
      Return the set of relationship types (in no particular order) that this index applies to. This method works for both mult-token indexes, and "single-token" indexes.

      Note that this assumes that this is a relationship index (that isRelationshipIndex() returns true). If thisk is not the case, then an IllegalStateException is thrown.

      Returns:
      the set of relationship types this index definition is associated with.
    • getPropertyKeys

      Iterable<String> getPropertyKeys()
      Return the set of properties that are indexed by this index.

      Most indexes will only have a single property, but composite indexes will have multiple properties.

      Returns:
      the property keys this index was created on.
      See Also:
    • getIndexType

      IndexType getIndexType()
      Get the index type of this index.
      Returns:
      The IndexType this index was defined with.
    • drop

      void drop()
      Drops this index. Schema.getIndexes(Label) will no longer include this index and any related background jobs and files will be stopped and removed.
    • isConstraintIndex

      boolean isConstraintIndex()
      Returns:
      true if this index is used to power a uniqueness constraint.
    • isNodeIndex

      boolean isNodeIndex()
      Returns:
      true if this index is indexing nodes, otherwise false.
    • isRelationshipIndex

      boolean isRelationshipIndex()
      Returns:
      true if this index is indexing relationships, otherwise false.
    • isMultiTokenIndex

      boolean isMultiTokenIndex()
      A multi-token index is an index that indexes nodes or relationships that have any or all of a given set of labels or relationship types, respectively.

      For instance, a multi-token index could apply to all Movie and Book nodes that have a description property. A node or relationship do not need to have all of the labels or relationship types for it to be indexed. A node that has any of the given labels, or a relationship that has any of the given relationship types, will be a candidate for indexing, depending on their properties.

      Returns:
      true if this is a multi-token index.
    • isCompositeIndex

      boolean isCompositeIndex()
      A composite index is an index that indexes nodes or relationships by more than one property.

      For instance, a composite index for PhoneNumber nodes could be indexing the country_code, area_code, prefix, and line_number. Note: it is index-implementation specific if a node or relationship must have all of the properties in order to be indexable, or if having any of the properties is enough for the given node or relationship to be indexed. For instance, NODE KEY constraint indexes require that all of the properties be present on a node before it will be included in the index, while a full-text index will index nodes or relationships that have any of the given properties.

      Returns:
      true if this is a composite index.
    • getName

      String getName()
      Get the name given to this index when it was created. Indexes that were not explicitly given a name at creation, will have an auto-generated name.
      Returns:
      the unique name of the index.
    • getIndexConfiguration

      Map<IndexSetting,Object> getIndexConfiguration()
      Get the index configuration that this index was created with.
      Returns:
      The index configuration as a read-only map.