elasticsearch 字段[_id]是元数据字段,无法添加到文档中,请使用索引API请求参数

pvcm50d1  于 2022-12-11  发布在  ElasticSearch
关注(0)|答案(1)|浏览(260)

我尝试批量添加,如自述文件所示,但却收到此错误:

"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters"

我尝试添加的模型只是一个测试模型,类似于:

"_id" => "57028f25633db3473d0041c8"

数据来自Mongo DB示例
我使用的是Windown 10,Phpstorm,Xampp,Laravel 5.5,jenssegers/mongodb,ElasticSearch6.0.0,
我的代码:

\App\Product::createIndex($shards = null, $replicas = null);
\App\Product::putMapping($ignoreConflicts = true);
\App\Product::addAllToIndex();
64jmpszr

64jmpszr1#

当我将cloudwatch日志重定向到ElasticSearch by terraform时,我遇到了同样的问题。通过为cloudwatch订阅过滤器添加filter_pattern(在它为空之前)解决了这个问题。

resource "aws_cloudwatch_log_subscription_filter" "cloudwatch_logs_to_es" {
  depends_on = [aws_lambda_permission.cloudwatch_allow]
  name            = var.clw_subscription_filter_name
  log_group_name  = aws_cloudwatch_log_group.auth0_log_group.name
  filter_pattern  = "[host, ident, authuser, date, request, status, bytes]"
  destination_arn = aws_lambda_function.cwl_stream_lambda.arn
}

相关问题