Commit f57dfa1 1 parent 02b6d3a commit f57dfa1 Copy full SHA for f57dfa1
File tree 1 file changed +14
-7
lines changed
1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,8 @@ Behavior
77
77
Examples
78
78
--------
79
79
80
- Create Indexes with Static and Dynamic Mappings
81
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80
+ Create an Index with Dynamic Mappings
81
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82
82
83
83
The following example creates an Atlas Search index using
84
84
`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
91
91
92
92
$collection = (new MongoDB\Client)->selectCollection('test', 'articles');
93
93
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
+ ]
97
101
);
98
102
99
- var_dump($indexName );
103
+ var_dump($indexNames );
100
104
101
105
The output would then resemble:
102
106
103
107
.. code-block:: none
104
108
105
- string(17) "test-search-index"
109
+ array(1) {
110
+ [0]=>
111
+ string(17) "test-search-index"
112
+ }
106
113
107
114
See Also
108
115
--------
You can’t perform that action at this time.
0 commit comments