Skip to content

Commit d8a990a

Browse files
authored
(DOCSP-27483) Adds guidance to create Atlas search index from a file (#146)
* (DOCSP-27483) Adds guidance to create Atlas search index from a file * Includes changes from copy review
1 parent 69f9016 commit d8a990a

File tree

4 files changed

+105
-1
lines changed

4 files changed

+105
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"collectionName": "listingsAndReviews",
3+
"database": "sample_airbnb",
4+
"name": "myIndex",
5+
"mappings": {
6+
"dynamic": true
7+
}
8+
}

source/reference/json.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,16 @@ To learn more about cloud backup schedule configuration files, see
102102
:ref:`atlas-cli-cloud-backup-schedule-config-file`. For a sample file,
103103
see :ref:`example-cloud-backup-schedule-config-file`.
104104

105+
Atlas Search Index Configuration File
106+
-------------------------------------
107+
108+
To learn more about |fts| index configuration files, see
109+
:ref:`atlas-cli-search-index-config-file`. For a sample file,
110+
see :ref:`example-search-index-config-file`.
111+
105112
.. toctree::
106113
:titlesonly:
107114

108115
/reference/json/cluster-config-file
109116
/reference/json/cloud-backup-schedule-config-file
117+
/reference/json/search-index-config-file
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
.. _atlas-cli-search-index-config-file:
2+
3+
=====================================
4+
Atlas Search Index Configuration File
5+
=====================================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
You can use an |fts| index configuration file to specify the required
14+
settings for :ref:`creating a search index
15+
<atlas-clusters-search-indexes-create>` using the {+atlas-cli+}. The
16+
{+atlas-cli+} accepts ``.json`` search index configuration files.
17+
18+
.. _search-index-settings:
19+
20+
Atlas Search Index Settings
21+
---------------------------
22+
23+
You can specify the following settings in the |fts| index
24+
configuration file. For a full list of available settings, see
25+
the request body schema in the API specification:
26+
:oas-atlas-op:`Create One Atlas Search Index </createAtlasSearchIndex>`.
27+
28+
.. list-table::
29+
:header-rows: 1
30+
:widths: 20 10 70
31+
32+
* - Field
33+
- Type
34+
- Description
35+
36+
* - ``collectionName``
37+
- string
38+
- Label that identifies the collection for which you want to
39+
create an |fts| index.
40+
41+
* - ``database``
42+
- string
43+
- Label that identifies the database that contains the collection
44+
for which you want to create an |fts| index.
45+
46+
* - ``name``
47+
- string
48+
- Label that identifies this index. Within each namespace, names
49+
of all indexes in the namespace must be unique.
50+
51+
* - ``mappings``
52+
- object
53+
- Index specifications for the collection's fields.
54+
55+
* - ``mappings.dynamic``
56+
- boolean
57+
- Flag that indicates whether the index uses dynamic or static
58+
mappings. If omitted or if set to ``false``, ``mappings.fields`` is required. To learn more, see
59+
:atlas:`Atlas Search Index Syntax
60+
</atlas-search/index-definitions/>`.
61+
62+
63+
.. _example-search-index-config-file:
64+
65+
Example Atlas Search Index Configuration File
66+
---------------------------------------------
67+
68+
To create an |fts| index, specify the search index details as shown in
69+
the following example file:
70+
71+
.. literalinclude:: /includes/create-atlas-search-index-config-file.json
72+
73+
Example Atlas Search Index Create Command
74+
-----------------------------------------
75+
76+
After you create the file, run the command to create the |fts| search
77+
index and specify the ``clusterName`` and the ``file``. The
78+
following example creates a search index for the cluster named
79+
myCluster using a JSON index configuration file named
80+
search-config.json:
81+
82+
.. code-block::
83+
84+
atlas clusters search indexes create --clusterName myCluster --file search-config.json --output json
85+
86+
87+
88+

0 commit comments

Comments
 (0)