DatastoreNeedIndexException is thrown when no matching index was found for a query
requiring an index. Check the Indexes page in the Admin Console and your datastore-indexes.xml
file.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eDatastoreNeedIndexException\u003c/code\u003e is thrown when a query lacks a required index.\u003c/p\u003e\n"],["\u003cp\u003eCheck the Admin Console's Indexes page and the \u003ccode\u003edatastore-indexes.xml\u003c/code\u003e file to resolve this exception.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDatastoreNeedIndexException\u003c/code\u003e class has two constructors for creating instances, one with a message, the other with a message and a cause.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetMessage()\u003c/code\u003e retrieves the exception's message and is an override of the parent \u003ccode\u003eThrowable\u003c/code\u003e class method.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetMissingIndexDefinitionXml()\u003c/code\u003e can be used to retrieve the xml defining the missing index, if available.\u003c/p\u003e\n"]]],[],null,["# Exception DatastoreNeedIndexException (2.0.0)\n\n public class DatastoreNeedIndexException extends RuntimeException\n\n`DatastoreNeedIndexException` is thrown when no matching index was found for a query\nrequiring an index. Check the Indexes page in the Admin Console and your datastore-indexes.xml\nfile. \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) \n[Throwable.addSuppressed(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-) \n[Throwable.fillInStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#fillInStackTrace--) \n[Throwable.getCause()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getCause--) \n[Throwable.getLocalizedMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getLocalizedMessage--) \n[Throwable.getMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getMessage--) \n[Throwable.getStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getStackTrace--) \n[Throwable.getSuppressed()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getSuppressed--) \n[Throwable.initCause(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#initCause-java.lang.Throwable-) \n[Throwable.printStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--) \n[Throwable.printStackTrace(PrintStream)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintStream-) \n[Throwable.printStackTrace(PrintWriter)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintWriter-) \n[Throwable.setStackTrace(StackTraceElement\\[\\])](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement[]-) \n[Throwable.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#toString--)\n\nConstructors\n------------\n\n### DatastoreNeedIndexException(String message)\n\n public DatastoreNeedIndexException(String message)\n\n### DatastoreNeedIndexException(String message, Throwable cause)\n\n public DatastoreNeedIndexException(String message, Throwable cause)\n\nMethods\n-------\n\n### getMessage()\n\n public String getMessage()\n\n**Overrides** \n[Throwable.getMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getMessage--)\n\n### getMissingIndexDefinitionXml()\n\n public String getMissingIndexDefinitionXml()\n\nReturns the xml defining the missing index. Can be `null`."]]