From 8eff9789e51e4c3f621adb7a0a390925999a4db1 Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Wed, 7 Feb 2024 10:24:47 -0500 Subject: [PATCH] (DOCSP-36307): Fix inaccuracy for index on embedded field (#6263) * (DOCSP-36307): Fix inaccuracy for index on embedded field * tweak * spacing --- .../index-single/create-single-field-index.txt | 4 +--- .../indexes/embedded-object-need-entire-doc.rst | 3 +++ source/indexes.txt | 11 ++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 source/includes/indexes/embedded-object-need-entire-doc.rst diff --git a/source/core/indexes/index-types/index-single/create-single-field-index.txt b/source/core/indexes/index-types/index-single/create-single-field-index.txt index edeaf00c6ab..3b14149e1ac 100644 --- a/source/core/indexes/index-types/index-single/create-single-field-index.txt +++ b/source/core/indexes/index-types/index-single/create-single-field-index.txt @@ -122,9 +122,7 @@ The following query uses the index on the ``location`` field: Details ``````` -When you create an index on an embedded document, only queries that -specify the *entire* embedded document use the index. Queries on a -specific field within the document do not use the index. +.. include:: /includes/indexes/embedded-object-need-entire-doc.rst For example, the following queries *do not* use the index on the ``location`` field because they query on specific fields within the diff --git a/source/includes/indexes/embedded-object-need-entire-doc.rst b/source/includes/indexes/embedded-object-need-entire-doc.rst new file mode 100644 index 00000000000..c413f2022e0 --- /dev/null +++ b/source/includes/indexes/embedded-object-need-entire-doc.rst @@ -0,0 +1,3 @@ +When you create an index on an embedded document, only queries that +specify the entire embedded document use the index. Queries on a +specific field within the document do not use the index. diff --git a/source/indexes.txt b/source/indexes.txt index fe7bc627ab7..88e15beff97 100644 --- a/source/indexes.txt +++ b/source/indexes.txt @@ -52,10 +52,15 @@ example, consider the following scenarios: * - A salesperson often needs to look up client information by location. Location is stored in an embedded object with fields like ``state``, ``city``, and ``zipcode``. You can create an - index on the entire ``location`` object to improve performance - for queries on any field in that object. + index on the ``location`` object to improve performance for + queries on that object. - - :ref:`Single Field Index ` on an object + .. note:: + + .. include:: /includes/indexes/embedded-object-need-entire-doc.rst + + - :ref:`Single Field Index ` on an embedded + document * - A grocery store manager often needs to look up inventory items by name and quantity to determine which items are low stock. You can