Skip to content

Create differents index on the same field. #7763

Closed as not planned
Closed as not planned

Description

@mdre

I need to create different index on the same field. FullText and LSM_TREE. The first is for searches based on a part of the number.
The second is for when the exact field value is available.
I have this index:

CREATE INDEX `Investigacion_cuij_lucene` IF NOT EXISTS ON `Legajo` (cuij) FULL_TEXT; <<--- this is inherited 
CREATE INDEX `Legajo_cuij` IF NOT EXISTS ON `Legajo` (cuij) UNIQUE;

But ArcadeDB fail with this error:

2026-09-17 08:43:40.560 INFO  [PostCommandHandler] <nodo1> Error on command execution (PostCommandHandler): Cannot create the 
index on type 'Legajo' properties [cuij] as LSM_TREE (unique=true) because the index 'Investigacion_cuij_lucene' already exists on the parent 
type 'Investigacion' and the same properties as FULL_TEXT (unique=false). Drop the parent index or align the definition: it is not replaced 
implicitly because that would take the index away from the parent type

This indexes are ported from OrientDB.

Activity

  1. added
    engine
    on Sep 17, 2026
  2. added this to the 26.10.1 milestone on Sep 17, 2026
  3. self-assigned this
    on Sep 17, 2026
  4. added
    in progress
    on Sep 17, 2026
  5. lvca commented on Sep 17, 2026

    @lvca
    Member

    Thanks for the detailed report. I looked into this and it is not a bug: it is a deliberate design invariant, not something that slipped through.

    LocalDocumentType.indexesByProperties keys an index by its property set, and the engine holds exactly one index per property set per type (see the javadocs on IndexBuilder.conflictWithExistingIndex / conflictWithExistingIndexName and TypeIndexBuilder.indexesByProperties). That is why creating Legajo_cuij (LSM_TREE UNIQUE) on cuij is refused once Investigacion_cuij_lucene (FULL_TEXT) already covers cuij on the parent type Investigacion: the refusal is on purpose so that a second CREATE INDEX can never silently take an index away from a parent type (issue #4083) or leave a type briefly/permanently without an index if a replacing rebuild fails partway.

    OrientDB allowed several index definitions to coexist on the same property set; ArcadeDB intentionally narrowed that to one, and query planning, index selection, SEARCH_INDEX(...), DROP INDEX, and rebuild all assume it. Relaxing it to "N indexes per property set" would be a real schema/storage/planner change (not a quick fix), and is out of scope for this batch, which is bug fixes only.

    Workarounds available today, in order of preference:

    1. Put the two indexes on different property sets. If you can afford a second, denormalized property (e.g. a computed/duplicate cuij_text property kept in sync, or an embedded/virtual property) you can put FULL_TEXT on one and UNIQUE/LSM_TREE on the other, and both live side by side because they no longer collide on the same property list.
    2. Define the FULL_TEXT index directly on Legajo instead of inheriting it from Investigacion, if the parent type does not itself need full-text search on cuij. A same-type FULL_TEXT + a same-type LSM_TREE UNIQUE on the same property still collide today (same invariant), so this only helps if the full-text requirement is really per-subtype.
    3. Track uniqueness with a UNIQUE constraint enforced at the application layer (or a trigger/BEFORE INSERT/BEFORE UPDATE hook doing an exact-match lookup through the full-text index) instead of a second index, if you can tolerate giving up the index-backed enforcement.

    If multi-index-per-property is something you'd like to see supported, I'd suggest filing it as a separate feature request so it can be scoped and designed properly rather than folded into this fix batch.

    I'm leaving the "in progress" label off this one for now since there's no code change planned here - happy to revisit if a feature request is opened.

  6. removed
    in progress
    on Sep 17, 2026
  7. mdre commented on Sep 17, 2026

    @mdre
    Author

    Thanks @lvca. We can use a workaround.

  8. added
    severity:major
    on Sep 19, 2026
  9. lvca commented on Sep 21, 2026

    @lvca
    Member

    Closing as by design - the investigation is in the comment above and the reporter has a workaround.

    Recorded for the record in PR #7845's description: one index per property set per type is a deliberate invariant (LocalDocumentType.indexesByProperties), not an oversight. Replacing an inherited index implicitly would silently take it away from the parent type (#4083).

    Reopen if the inheritance rule itself should be revisited - that would be a separate design change rather than a bug in the current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugengineseverity:majorsql

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions