Skip to content

Commit c435c11

Browse files
DOCSP-11335 doc for search index update command (#164)
* DOCSP-11335 doc for search index update command * DOCSP-11335 update for copy review feedback
1 parent 133fe36 commit c435c11

File tree

2 files changed

+185
-0
lines changed

2 files changed

+185
-0
lines changed

source/reference/atlas/search-commands.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ Atlas Search Commands
1010
:titlesonly:
1111

1212
Create an Atlas Search Index </reference/atlas/search-index-create>
13+
Modify an Atlas Search Index </reference/atlas/search-index-update>
1314
Delete an Atlas Search Index </reference/atlas/search-index-delete>
1415

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
.. _mcli-atlas-search-index-update-command:
2+
3+
==========================================
4+
mongocli atlas cluster search index update
5+
==========================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
The ``search index update`` command modifies an |fts| :atlas:`index
16+
</reference/atlas-search/index-definitions/>`. You can also update an
17+
|fts| :atlas:`index </reference/atlas-search/index-management/>` through
18+
the |service| :atlas:`UI </reference/atlas-search/edit-index/>` or
19+
:atlas:`API </reference/api/fts-indexes-update-one/>`.
20+
21+
.. _mcli-atlas-search-index-update-syntax:
22+
23+
Syntax
24+
------
25+
26+
.. code-block:: text
27+
28+
mongocli atlas cluster search|fts index update <index-id>
29+
--clusterName <cluster-name>
30+
--collection <collection-name>
31+
--db <database-name>
32+
[ --dynamic ]
33+
[ --field <field-name>:<index-type> ]
34+
--indexName <index-name>
35+
[ --profile|-P <profile-name> ]
36+
[ --projectId <project-ID> ]
37+
[ --searchAnalyzer <analyzer-name> ]
38+
39+
.. _mcli-atlas-search-index-update-options:
40+
41+
Options
42+
-------
43+
44+
.. list-table::
45+
:header-rows: 1
46+
:widths: 20 10 60 10
47+
48+
* - Option
49+
- Type
50+
- Description
51+
- Required?
52+
53+
* - ``<index-id>``
54+
- string
55+
- Unique identifier of the |fts| index to modify.
56+
- yes
57+
58+
* - ``--clusterName``
59+
- string
60+
- Name of the cluster.
61+
- yes
62+
63+
* - ``--collection``
64+
- string
65+
- Name of the collection the |fts| index is on.
66+
- yes
67+
68+
* - ``--db``
69+
- string
70+
- Name of the database that contains the collection.
71+
- yes
72+
73+
* - ``--dynamic``
74+
- flag
75+
- Whether the |fts| index uses dynamic field mappings. This is required if
76+
``field`` is not specified. You cannot specify ``--field`` if this flag
77+
is set. If both ``--dynamic`` and ``--field`` are omitted, existing
78+
|fts| index settings are removed and neither dynamic nor static field
79+
mappings are enabled.
80+
81+
To learn more, see :atlas:`Static and Dynamic Mappings
82+
<reference/atlas-search/index-definitions/#static-and-dynamic-mappings>`.
83+
- no
84+
85+
* - ``--field``
86+
- string
87+
- Comma-separated list of fields to index in the following format:
88+
89+
.. code-block:: text
90+
:copyable: false
91+
92+
<field-name>:<index-type>
93+
94+
where:
95+
96+
- ``<field-name>`` is the name of the field to index.
97+
- ``<index-type>`` is the :atlas:`type
98+
</reference/atlas-search/index-definitions/#data-types/>` of index.
99+
Value can be one of the following: ``autocomplete``, ``boolean``,
100+
``date``, ``document``, ``geo``, ``number``, ``objectId``, ``string``.
101+
102+
This is required if the index uses static mappings. You cannot set the
103+
``--dynamic`` flag if field names are specified. If both ``--field``
104+
and ``--dynamic`` are omitted, existing |fts| index settings are removed
105+
and neither static nor dynamic field mappings are enabled.
106+
- no
107+
108+
* - ``indexName``
109+
- string
110+
- Name of the |fts| index to modify. You cannot change the name of the
111+
|fts| index.
112+
- yes
113+
114+
* - ``--profile``, ``-P``
115+
- string
116+
- Name of the profile where the public and private keys for the project
117+
are set. If omitted, uses the {+default-profile+}. To learn more about
118+
creating a profile, see :ref:`mcli-configure`.
119+
- no
120+
121+
* - ``--projectId``
122+
- string
123+
- Unique identifier of the project where you want to update the cluster.
124+
If omitted, uses the project ID in the profile or :ref:`environment
125+
variable <mcli-env-var>`.
126+
- no
127+
128+
* - ``--searchAnalyzer``
129+
- string
130+
- Analyzer to use when searching the index. Value can be one of the
131+
following:
132+
133+
- :atlas:`lucene.standard </reference/atlas-search/analyzers/standard/>`
134+
- :atlas:`lucene.simple </reference/atlas-search/analyzers/simple/>`
135+
- :atlas:`lucene.whitespace
136+
</reference/atlas-search/analyzers/whitespace/>`
137+
- :atlas:`lucene.language </reference/atlas-search/analyzers/language/>`
138+
- :atlas:`lucene.keyword </reference/atlas-search/analyzers/keyword/>`
139+
140+
If omitted, defaults to ``lucene.standard``.
141+
- no
142+
143+
.. _mcli-atlas-search-index-update-output:
144+
145+
Output
146+
------
147+
148+
.. include:: /includes/command-output-intro.rst
149+
150+
.. include:: /includes/atlas-search-index-output-fields.rst
151+
152+
.. _mcli-atlas-search-index-update-egs:
153+
154+
Example
155+
-------
156+
157+
The following example uses the ``mongocli atlas cluster search index update``
158+
command to modify an |fts| index named ``default`` on the
159+
``sample_mflix.movies`` collection in an |service| cluster named
160+
``myTestCluster`` to use dynamic field mappings and the ``lucene.keyword``
161+
analyzer. It uses the {+default-profile+} to access the project.
162+
163+
.. code-block:: text
164+
165+
mongocli atlas cluster search index update 5f2099cd683fc55fbb30bef6 --clusterName myTestCluster --db sample_mflix --collection movies --indexName default --dynamic --searchAnalyzer lucene.keyword
166+
167+
The previous command prints the following fields in |json| format to the
168+
terminal. To learn more about these fields, see
169+
:ref:`mcli-atlas-search-index-update-output`.
170+
171+
.. code-block:: json
172+
:copyable: false
173+
174+
{
175+
"analyzer": "lucene.standard",
176+
"collectionName": "movies",
177+
"database": "sample_mflix",
178+
"indexID": "5f2099cd683fc55fbb30bef6",
179+
"mappings": {
180+
"dynamic": true
181+
},
182+
"name": "default",
183+
"searchAnalyzer": "lucene.keyword"
184+
}

0 commit comments

Comments
 (0)