Skip to content

--require-indexes (datastore-mode) falsely requires a composite index for an equality-only multi-property query #11051

Description

@anoteboom

[REQUIRED] Environment info

firebase-tools: 15.22.2
Platform: Windows 11

The Firestore emulator, run in datastore-mode with --require-indexes, rejects a query that has only equality filters on two different properties (no inequality, no sort order) as requiring a composite index. Per Google's own documentation, such queries are covered by built-in single-property indexes and should not need one.

[REQUIRED] Test case

gcloud emulators firestore start --database-mode=datastore-mode --require-indexes --index-file=index.yaml

[REQUIRED] Steps to reproduce

Run a query equivalent to:
Person.query().filter(Person.google_plus_id == "x").filter(Person.user == True).get()
(REST equivalent: runQuery with a compositeFilter/AND of two EQUAL propertyFilters, no order.)

[REQUIRED] Expected behavior

Query succeeds using built-in indexes, per "Indexes | Datastore": "Firestore in Datastore mode provides built-in ... indexes for [queries] using only ancestor and equality filters."

[REQUIRED] Actual behavior

400 FAILED_PRECONDITION: The query requires a composite index that is not defined in your indexes file.

Impact

Makes --require-indexes unusable at scale — it produces this false positive on every equality-only multi-filter query in the codebase, of which there can be hundreds, making it impossible to distinguish real missing
indexes from noise without manually reasoning through each one.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions