|
4 | 4 | Atlas Search Index Configuration File |
5 | 5 | ===================================== |
6 | 6 |
|
| 7 | +.. facet:: |
| 8 | + :name: genre |
| 9 | + :values: tutorial |
| 10 | + |
7 | 11 | .. contents:: On this page |
8 | 12 | :local: |
9 | 13 | :backlinks: none |
10 | 14 | :depth: 1 |
11 | 15 | :class: singlecol |
12 | 16 |
|
13 | | -You can use an |fts| index configuration file to specify the required |
14 | | -settings for creating a search index using the {+atlas-cli+}. The |
15 | | -{+atlas-cli+} accepts ``.json`` search index configuration files. You |
16 | | -can use the ``.json`` search index configuration file to create the |
17 | | -index for :ref:`cloud <atlas-clusters-search-indexes-create>` and |
18 | | -:ref:`local <atlas-deployments-search-indexes-create>` Atlas |
19 | | -deployments. |
| 17 | +.. |atlas-cli command| replace:: :ref:`atlas-clusters-search-indexes-create` |
| 18 | +.. |configuration-file-name| replace:: search index configuration |
| 19 | +.. |openapi-link| replace:: :oas-atlas-op:`Create One Atlas Search Index </createAtlasSearchIndex>` |
| 20 | +.. |action| replace:: create an Atlas Search index |
| 21 | + |
| 22 | +You can use a |configuration-file-name| file to specify the |
| 23 | +settings required when you |action| using the {+atlas-cli+}. The |
| 24 | +{+atlas-cli+} accepts ``.json`` |configuration-file-name| files. |
20 | 25 |
|
21 | 26 | .. _search-index-settings: |
22 | 27 |
|
23 | | -Atlas Search Index Settings |
24 | | ---------------------------- |
| 28 | +Available Settings |
| 29 | +------------------ |
25 | 30 |
|
26 | | -You can specify the following settings in the |fts| index |
27 | | -configuration file. For a full list of available settings, see |
28 | | -the request body schema in the API specification: |
29 | | -:oas-atlas-op:`Create One Atlas Search Index </createAtlasSearchIndex>`. |
30 | | - |
31 | | -.. list-table:: |
32 | | - :header-rows: 1 |
33 | | - :widths: 20 10 70 |
34 | | - |
35 | | - * - Field |
36 | | - - Type |
37 | | - - Description |
38 | | - |
39 | | - * - ``collectionName`` |
40 | | - - string |
41 | | - - Label that identifies the collection for which you want to |
42 | | - create an |fts| index. |
43 | | - |
44 | | - * - ``database`` |
45 | | - - string |
46 | | - - Label that identifies the database that contains the collection |
47 | | - for which you want to create an |fts| index. |
48 | | - |
49 | | - * - ``name`` |
50 | | - - string |
51 | | - - Label that identifies this index. Within each namespace, names |
52 | | - of all indexes in the namespace must be unique. |
53 | | - |
54 | | - * - ``mappings`` |
55 | | - - object |
56 | | - - Index specifications for the collection's fields. |
57 | | - |
58 | | - * - ``mappings.dynamic`` |
59 | | - - boolean |
60 | | - - Flag that indicates whether the index uses dynamic or static |
61 | | - mappings. If omitted or if set to ``false``, ``mappings.fields`` is required. To learn more, see |
62 | | - :atlas:`Atlas Search Index Syntax |
63 | | - </atlas-search/index-definitions/>`. |
| 31 | +When you |action| using a configuration file, you |
| 32 | +can specify any settings that are listed in |
| 33 | +|openapi-link| under :guilabel:`Request Body Schema`. |
64 | 34 |
|
65 | 35 | .. _example-search-index-config-file: |
66 | 36 |
|
67 | | -Example Atlas Search Index Configuration File |
68 | | ---------------------------------------------- |
69 | | - |
70 | | -To create an |fts| index, define the search index in your |json| file as |
71 | | -shown in the following example file: |
72 | | - |
73 | | -.. tabs:: |
74 | | - |
75 | | - .. tab:: Basic Configuration |
76 | | - :tabid: basic |
77 | | - |
78 | | - The following configuration automatically indexes all dynamically |
79 | | - indexable fields in the ``sample_airbnb.listingsAndReviews`` collection. |
80 | | - |
81 | | - .. literalinclude:: /includes/create-atlas-search-index-config-file.json |
82 | | - |
83 | | - .. tab:: Expanded Configuration |
84 | | - :tabid: expanded |
85 | | - |
86 | | - The following configuration indexes only the ``name`` and |
87 | | - ``property_type`` fields in the |
88 | | - ``sample_airbnb.listingsAndReviews`` collection. |
89 | | - |
90 | | - .. literalinclude:: /includes/create-atlas-search-expanded-index-config-file.json |
91 | | - |
92 | | -Example Atlas Search Index Create Command |
93 | | ------------------------------------------ |
94 | | - |
95 | | -.. tabs:: |
96 | | - |
97 | | - .. tab:: Cloud Deployment |
98 | | - :tabid: cloud |
| 37 | +Create a Configuration File |
| 38 | +--------------------------- |
99 | 39 |
|
100 | | - After you create the file, run the command to create the |fts| |
101 | | - search index and specify the ``clusterName`` and the ``file``. The |
102 | | - following example creates a search index for the cluster named |
103 | | - ``myCluster`` using a JSON index configuration file named |
104 | | - ``search-config.json``: |
| 40 | +Follow these steps to |action| with a configuration file: |
105 | 41 |
|
106 | | - .. code-block:: |
| 42 | +.. procedure:: |
| 43 | + :style: normal |
107 | 44 |
|
108 | | - atlas clusters search indexes create --clusterName myCluster --file search-config.json --output json |
| 45 | + .. step:: Copy the sample request for |openapi-link|. |
109 | 46 |
|
110 | | - .. tab:: Local Deployment |
111 | | - :tabid: local |
| 47 | + a. Navigate to the |openapi-link| |
| 48 | + section of the |service| Admin API specification. |
| 49 | + b. Under :guilabel:`Request samples` on the right side, click |
| 50 | + :guilabel:`Expand all`. |
| 51 | + c. Click :guilabel:`Copy` to copy the sample request. |
112 | 52 |
|
113 | | - After you create the file, run the command to create the |fts| |
114 | | - search index and specify the ``deploymentName`` and the ``file``. |
115 | | - The following example creates a search index for a deployment |
116 | | - named ``myLocalRs`` using a JSON index configuration file named |
117 | | - ``search-config.json``: |
| 53 | + .. step:: Create the configuration file. |
| 54 | + |
| 55 | + a. Paste the copied sample request into a text editor and change |
| 56 | + the values to reflect your values. |
| 57 | + b. Save the file with a ``.json`` extension. |
118 | 58 |
|
119 | | - .. code-block:: |
| 59 | + .. step:: Run the |atlas-cli command| command with |
| 60 | + the ``--file`` option. |
120 | 61 |
|
121 | | - atlas deployments search indexes create --deploymentName myLocalRs --file search-config.json --output json |
| 62 | + Specify the path to the file you saved with the ``--file`` flag. |
0 commit comments