簡體   English   中英

彈性搜索+ JSON導入(ELK堆棧)

[英]Elastic Search + JSON import (ELK Stack)

我目前正在嘗試將基本的JSON文件導入到我的ELK堆棧中。 我嘗試通過這樣的POST請求直接導入它:

curl -XPOST http:// localhost:9200 / kwd_results / TS_Cart -d @ / home / local / TS_Cart.json

ES表示可以導入,但是當我嘗試查看Kibanna中的日志時,JSON文件的節點未對它們進行索引。 我猜想我需要像模板映射才能正確查看它。

我的JSON文件如下所示:

{
  "testResults": {
    "FitNesseVersion": "v20160618",
    "rootPath": "K1System.CountryDe.DriverFirefox.TestCases.MainFolder.TestVariants.SmokeTests_B2C.TS_Cart",
    "result": [
      {
        "counts": {
          "right": "16",
          "wrong": "2",
          "ignores": "3",
          "exceptions": "1"
        },
        "date": "2017-05-10T00:01:11+02:00",
        "runTimeInMillis": "117242",
        "relativePageName": "TestCase_1",
        "pageHistoryLink": "K1System.CountryDe.DriverFirefox.TestCases.MainFolder.TestVariants.SmokeTests_B2C.TS_Cart.B2CFreeCatalogueOrder?pageHistory&resultDate=20170510000111",
        "tags": "de, at"
      },
      {
        "counts": {
          "right": "16",
          "wrong": "0",
          "ignores": "0",
          "exceptions": "0"
        },
        "date": "2017-05-10T00:03:08+02:00",
        "runTimeInMillis": "85680",
        "relativePageName": "TestCase_2",
        "pageHistoryLink": "K1System.CountryDe.DriverFirefox.TestCases.MainFolder.TestVariants.SmokeTests_B2C.TS_Cart.B2CGiftCardOrderWithAdvancePayment?pageHistory&resultDate=20170510000308",
        "tags": "at, de"
      }
    ],
    "finalCounts": {
      "right": "4",
      "wrong": "1",
      "ignores": "0",
      "exceptions": "0"
    },
    "totalRunTimeInMillis": "482346"
  }
}

基本上,我需要將rootPath用作索引,同時具有以下子項: counts, relativePageName, date and tags 注意,我有兩個節點是result []數組的子節點。

任何幫助將不勝感激!

謝謝。

好吧,這是一個JSON文檔,因此Elasticsearch將其視為此類文檔。

您需要(以編程方式)將文檔拆分為正確的文檔,然后才能存儲它們(可能有一個_bulk請求)。

對於索引名稱:

  1. 必須為小寫,因此您需要轉換該值。
  2. 您是否會有許多不同的根路徑,並且每個路徑都有一些文檔? 然后,您不應該將它們全部作為索引,因為它們每個都有開銷(實際上是基礎分片)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM