我尝试了批量添加,如图所示是您的自述文件,但我收到此错误:
"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters"
Run Code Online (Sandbox Code Playgroud)
我要添加的模型只是一个测试模型,它类似于:
"_id" => "57028f25633db3473d0041c8"
Run Code Online (Sandbox Code Playgroud)
数据来自 Mongo 数据库实例
我正在使用 Windown 10、Phpstorm、xampp、Laravel 5.5、jenssegers/mongodb、elasticquent/elasticquent 1.0、Elasticsearch 6.0.0、
我的代码:
\App\Product::createIndex($shards = null, $replicas = null);
\App\Product::putMapping($ignoreConflicts = true);
\App\Product::addAllToIndex();
Run Code Online (Sandbox Code Playgroud)