Stay organized with collections
Save and categorize content based on your preferences.
@Documented
@Retention(value = RetentionPolicy.CLASS)
@Target(value = [ElementType.FIELD, ElementType.METHOD])
public annotation Document.Namespace
Marks a member field of a document as the document's namespace.
The namespace is an arbitrary user-provided string that can be used to group documents during querying or deletion. Indexing a document with a particular ID replaces any existing documents with the same ID in that namespace.
A document must have exactly one such field, and it must be of type String
.
See the class description of Document
for other requirements (i.e. if present it must be visible, or have a visible getter and setter, or be exposed through a visible constructor).
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-07-17 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-17 UTC."],[],[],null,["# Document.Namespace\n==================\n\nArtifact: [androidx.appsearch:appsearch](/jetpack/androidx/releases/appsearch) \n[View Source](https://cs.android.com/search?q=file:androidx/appsearch/annotation/Document.java+class:androidx.appsearch.annotation.Document.Namespace) \nAdded in [1.1.0](/jetpack/androidx/releases/appsearch#1.1.0)\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/androidx/appsearch/annotation/Document.Namespace \"View this page in Kotlin\") \\|Java\n\n\n```\n@Documented\n@Retention(value = RetentionPolicy.CLASS)\n@Target(value = [ElementType.FIELD, ElementType.METHOD])\npublic annotation Document.Namespace\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nMarks a member field of a document as the document's namespace.\n\nThe namespace is an arbitrary user-provided string that can be used to group documents during querying or deletion. Indexing a document with a particular ID replaces any existing documents with the same ID in that namespace.\n\nA document must have exactly one such field, and it must be of type [String](https://developer.android.com/reference/java/lang/String.html).\n\nSee the class description of [Document](/reference/androidx/appsearch/annotation/Document) for other requirements (i.e. if present it must be visible, or have a visible getter and setter, or be exposed through a visible constructor)."]]