无法在 elaticearch 中使用 curl 命令创建可视化



我正在尝试使用 curl 命令创建可视化。我正在使用弹性搜索 6.2.3。我能够在弹性搜索 5.6.8 中创建相同的内容。我正在使用此命令 curl -XPUT http://localhost:9200/.kibana/visualization/vis1 -H 'Content-Type: application/json' -d @vis1.json它显示此错误:

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Rejecting mapping update to [.kibana] as the final mapping would have more than 1 type: [visualization, doc]"}],"type":"illegal_argument_exception","reason":"Rejecting mapping update to [.kibana] as the final mapping would have more than 1 type: [visualization, doc]"},"status":400}

vis1.json的内容:

{
      "title": "vis1",
      "visState": "{"title":"vis1","type":"table","params":{"perPage":10,"showMeticsAtAllLevels":false,"showPartialRows":false,"showTotal":false,"sort":{"columnIndex":null,"direction":null},"totalFunc":"sum"},"aggs":[{"id":"1","enabled":true,"type":"count","schema":"metric","params":{}},{"id":"2","enabled":true,"type":"date_histogram","schema":"split","params":{"field":"UsageEndDate","interval":"M","customInterval":"2h","min_doc_count":1,"extended_bounds":{},"row":false}},{"id":"3","enabled":true,"type":"terms","schema":"bucket","params":{"field":"ProductName.keyword","otherBucket":false,"otherBucketLabel":"Other","missingBucket":false,"missingBucketLabel":"Missing","size":5,"order":"desc","orderBy":"1"}}]}",
      "uiStateJSON": "{"vis":{"params":{"sort":{"columnIndex":null,"direction":null}}}}",
      "description": "",
      "version": 1,
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{"index":"4eb9f840-3969-11e8-ae19-552e148747c3","filter":[],"query":{"language":"lucene","query":""}}"
      }
    }

这在 elasticearch 5.6.8 中工作正常,但在 6.2.3 中则不然。

提前谢谢。

在 Kibana 6 中,.kibana索引的映射已更改,以满足即将到来的"每个索引一个映射"中断性更改。

您可以尝试以下方式:

curl -XPUT http://localhost:9200/.kibana/doc/visualization:vis1 -H 'Content-Type: application/json' -d @vis1.json

此外,vis1.json文件需要稍微更改一下(内容需要移动到visualization小节(,如下所示:

{
  "type": "visualization",
  "updated_at": "2018-04-10T10:00:00.000Z",
  "visualization": {
    "title": "vis1",
    "visState": "{"title":"vis1","type":"table","params":{"perPage":10,"showMeticsAtAllLevels":false,"showPartialRows":false,"showTotal":false,"sort":{"columnIndex":null,"direction":null},"totalFunc":"sum"},"aggs":[{"id":"1","enabled":true,"type":"count","schema":"metric","params":{}},{"id":"2","enabled":true,"type":"date_histogram","schema":"split","params":{"field":"UsageEndDate","interval":"M","customInterval":"2h","min_doc_count":1,"extended_bounds":{},"row":false}},{"id":"3","enabled":true,"type":"terms","schema":"bucket","params":{"field":"ProductName.keyword","otherBucket":false,"otherBucketLabel":"Other","missingBucket":false,"missingBucketLabel":"Missing","size":5,"order":"desc","orderBy":"1"}}]}",
    "uiStateJSON": "{"vis":{"params":{"sort":{"columnIndex":null,"direction":null}}}}",
    "description": "",
    "version": 1,
    "kibanaSavedObjectMeta": {
      "searchSourceJSON": "{"index":"4eb9f840-3969-11e8-ae19-552e148747c3","filter":[],"query":{"language":"lucene","query":""}}"
    }
  }
}

最新更新