File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ Behavior
7777Examples
7878--------
7979
80- Create Indexes with Static and Dynamic Mappings
81- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80+ Create an Index with Dynamic Mappings
81+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8282
8383The following example creates an Atlas Search index using
8484`dynamic mappings <https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#dynamic-mappings>`__
@@ -91,18 +91,25 @@ to index all document fields containing
9191
9292 $collection = (new MongoDB\Client)->selectCollection('test', 'articles');
9393
94- $indexName = $collection->createSearchIndex(
95- ['mappings' => ['dynamic' => true]],
96- ['name' => 'test-search-index']
94+ $indexNames = $collection->createSearchIndexes(
95+ [
96+ [
97+ 'name' => 'test-search-index',
98+ 'definition' => ['mappings' => ['dynamic' => true]],
99+ ],
100+ ]
97101 );
98102
99- var_dump($indexName );
103+ var_dump($indexNames );
100104
101105The output would then resemble:
102106
103107.. code-block:: none
104108
105- string(17) "test-search-index"
109+ array(1) {
110+ [0]=>
111+ string(17) "test-search-index"
112+ }
106113
107114See Also
108115--------
You can’t perform that action at this time.
0 commit comments