当前位置: 首页 > 面试题库 >

ElasticSearch非法参数异常

涂煌
2023-03-14
问题内容

我正在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。
有什么建议吗?


问题答案:

问题是您丢失了,document type并且document id在通过PUT http://localhost:9200/aws命令索引文档时。

索引文档的正确方法是:

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

即,您必须提供document type(此处为my-type)和document id(此处为my-
id-1)。请注意,此处的文档ID是可选的,因此,如果您不提供文档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"
}

注意: 如果禁用了自动索引创建,则必须在索引文档之前创建索引。



 类似资料:
  • 我正在处理一个非常简单的point类,但我得到了一个错误,我无法确定字符串/双值问题发生的位置或如何修复它。 编辑 我忘记添加我正在接收的错误:

  • 在Java jar上运行JUnit5测试并加载依赖项时,会出现警告 当我去看dumpstream时,它充满了评论,比如: 解决了依赖项加载问题,但未解决损坏的流。

  • 基本上,我试图加载一些图像数据到java作为ImageIcon对象。我最初尝试简单地做ImageIcon图像=新ImageIcon(文件名),但这使得图像在导出为JAR文件时不会加载。我做这件事的新方法是: 这个错误是因为吃豆人。班getResource(文件名)返回null。我的目录是这样的:我的PacMan类位于src/Model/PacMan中,我的映像具有以下文件路径: 此外,我还尝试恢复

  • 我试图按照本指南共享从glide加载到imageview中的图像,它给了我一个非法参数异常。我已经把代码和stacktrace贴在下面了 维护性。xml Androidmanifest。xml 文件提供者。xml 堆栈痕迹 JAVAlang.IllegalArgumentException:未能找到包含/storage/sdcard0/images1502651207040的配置根目录。Andro

  • 对于不熟悉Java等,我必须道歉。现在,我正在尝试开发一个简单的游戏。目前,我所要做的就是能够在电路板上移动计数器,但每当我这样做时,都会收到错误消息。这似乎与我用于游戏板的GridPane的onMouseClicked属性有关,因为即使handleMovement方法为空,每当我单击鼠标时,仍然会出现所有这些错误: 我的控制器类别: } 我的FXML: 我的主要课程: 我使用了这个问题答案中的代

  • 我有一个Customer和CustomerFullAddress类,我正在使用JAXB尝试生成一个XML文件 Customer类如下所示(它不是完整的实现) 而CustomerFullAddress是 错误是 异常线程"main"com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsExcture:存在2个IllegalAnnotationE