2017-04-24 13 views
1

私はUbuntu 16.04でElasticsearch最新バージョンを使用しています。データを置く際に少し問題があります。ここ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" } 
     } 
    } 
} 

であり、ここで私は

{ "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 } 

"http://localhost:9200/awsをPUT" しようとすると、ESからの戻り応答だESは "と思うように思えますclockSpeed "は何らかの設定です...? 最初にすべてのドキュメントをマッピングし、それをESにインポートするのではなく、ダイナミックマッピングを使用してプロセスを高速化することを望んでいました。
提案がありますか?

答えて

0

skuフィールドを更新しています問題は、PUT http://localhost:9200/awsコマンドで文書を索引付けするときにdocument typedocument idが欠落していることです。インデックス文書に

適切な方法がある:あなたがdocument type(ここでは私のタイプ)とdocument id(ここでは私の-ID-1)を提供する必要が

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

すなわち。ここでdocument idはオプションであることに注意してください。そうしないと、elasticsearchは1つの英数字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" 
} 

注:自動インデックス作成が無効化されていると場合は、インデックスの文書の前にインデックスを作成する必要があります。

+0

私は、ありがとう、それが有用だ見て! –

+0

上記の回答で問題が解決した場合は、回答を回答として受け入れることで問題を解決できます。 – avr

0

きれいなマッピングが与えられた場合、XPOSTはelasticsearch 5.1.1で完全に機能します。

​​

GET挿入DOC

curl -XGET localhost:9200/productsapp/productdocs/_search 
{"took":11,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"productsapp","_type":"productdocs","_id":"AVuhXdYYUiSguAb0FsSX","_score":1.0,"_source":{ "products" : { 
    "sku1" : { 
     "sku" : "SKU-Name", 
     "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" } 
     } 
    } 
}}]}} 

が作成マッピングはclockSpeedtextとしてタイプと、以下の通りです。

curl -XGET localhost:9200/productsapp/productdocs/_mapping?pretty=true 
{ 
    "productsapp" : { 
    "mappings" : { 
     "productdocs" : { 
     "properties" : { 
      "products" : { 
      "properties" : { 
       "232CDFDW89ENUXRB" : { 
       "properties" : { 
        "attributes" : { 
        "properties" : { 
         "clockSpeed" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "currentGeneration" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "enhancedNetworkingSupported" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "instanceFamily" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "instanceType" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "licenseModel" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "location" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "locationType" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "memory" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "networkPerformance" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "operatingSystem" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "operation" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "physicalProcessor" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "preInstalledSw" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "processorArchitecture" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "processorFeatures" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "servicecode" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "storage" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "tenancy" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "usagetype" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         }, 
         "vcpu" : { 
         "type" : "text", 
         "fields" : { 
          "keyword" : { 
          "type" : "keyword", 
          "ignore_above" : 256 
          } 
         } 
         } 
        } 
        }, 
        "productFamily" : { 
        "type" : "text", 
        "fields" : { 
         "keyword" : { 
         "type" : "keyword", 
         "ignore_above" : 256 
         } 
        } 
        }, 
        "sku" : { 
        "type" : "text", 
        "fields" : { 
         "keyword" : { 
         "type" : "keyword", 
         "ignore_above" : 256 
         } 
        } 
        } 
       } 
       } 
      } 
      } 
     } 
     } 
    } 
    } 
} 

attributes.clockSpeedのマッピングをチェックして、それが不正でないことを確認できますか?

そして、あなたは、ドキュメントを更新したい場合は、最初の文書のIDにXPUTを行う(AVuhXdYYUiSguAb0FsSXである)、次の例で

、私は"sku name updated"

curl -XPUT localhost:9200/productsapp/productdocs/AVuhXdYYUiSguAb0FsSX -d ' 
{ 
      "products" : { 
      "sku1" : { 
       "sku" : "sku name updated", 
       "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" 
       } 
      } 
      }}' 
{"_index":"productsapp","_type":"productdocs","_id":"AVu5OLfHPw6Pv_3O38-V","_version":2,"result":"updated","_shards":{"total":2,"successful":1,"failed":0},"created":false} 
+0

私はあなたのやり方を試してみましたが、正しく動作しています。また、マッピングはOKです。 あなたはどう答えたのですか? –

+0

どのように挿入しているのか分かりませんか?私はまだ行って、エラーが発生したタイプのclockSpeedのマッピングが何であるかを確認することをお勧めします。 – prayagupd

+0

と同じですが、インデックスを指定するだけです:curl -XPOST http:// localhost:9200/aws/-d '{~~}' –

関連する問題