gpt4 book ai didi

ElasticSearch 非法参数异常

转载 作者:行者123 更新时间:2023-12-02 22:23:14 26 4
gpt4 key购买 nike

我在 Ubuntu 16.04 上使用 Elasticsearch 最新版本,但在将数据放入其中时遇到了一些小问题。

这是我的 json 文档(相关部分)

{   "products" : {
"232CDFDW89ENUXRB" : {
"sku" : "232CDFDW89ENUXRB",
"productFamily" : "Compute Instance",
"attributes" : {
"servicecode" : "AmazonEC2",
"location" : "US East (N. Virginia)",
"locationType" : "AWS Region",
"instanceType" : "d2.8xlarge",
"currentGeneration" : "Yes",
"instanceFamily" : "Storage optimized",
"vcpu" : "36",
"physicalProcessor" : "Intel Xeon E5-2676v3 (Haswell)",
"clockSpeed" : "2.4 GHz",
"memory" : "244 GiB",
"storage" : "24 x 2000 HDD",
"networkPerformance" : "10 Gigabit",
"processorArchitecture" : "64-bit",
"tenancy" : "Host",
"operatingSystem" : "Linux",
"licenseModel" : "No License required",
"usagetype" : "HostBoxUsage:d2.8xlarge",
"operation" : "RunInstances",
"enhancedNetworkingSupported" : "Yes",
"preInstalledSw" : "NA",
"processorFeatures" : "Intel AVX; Intel AVX2; Intel Turbo" }
}
}
}

这是当我尝试“PUT http://localhost:9200/aws”时来自 ES 的返回响应

{ "error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "unknown setting [index.products.232CDFDW89ENUXRB.attributes.clockSpeed] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.products.232CDFDW89ENUXRB.attributes.clockSpeed] please check that any required plugins are installed, or check the breaking changes documentation for removed settings" }, "status": 400 }

在我看来,ES 认为“clockSpeed”是某种设置...?我希望使用动态映射来加快处理速度,而不是先映射所有文档,然后再将其导入 ES。
有什么建议吗?

最佳答案

问题是您在通过 PUT http://localhost:9200/aws 索引文档时缺少 document typedocument id命令。

索引文档的正确方法是:

POST my-index/my-type/my-id-1
{
"name": "kibana"
}

即您必须提供文档类型(此处为 my-type)和文档 ID(此处为 my-id-1)。请注意,此处的文档 ID 是可选的,因此如果您不提供,则 elasticsearch 会为您创建一个字母数字 ID。

索引文档的其他几种方法:

POST my-index/my-type
{
"name": "kibana"
}

//if you want to index document through PUT then you must provide document id
PUT my-index/my-type/my-id-1
{
"name": "kibana"
}

注意:如果自动创建索引被禁用,那么您必须在索引文档之前创建索引。

关于ElasticSearch 非法参数异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43595853/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com