【问题标题】:Search in Jaeger ElasticSearch在 Jaeger ElasticSearch 中搜索
【发布时间】:2020-07-31 20:24:38
【问题描述】:

我的 Jaeger ElasticSearc 查询返回以下条目

    "_index" : "jaeger-span-2020-07-31",
    "_type" : "span",
    "_source" : {
      "startTime" : 1596157225275112,
      "startTimeMillis" : 1596157225275,
      "duration" : 0,
      "tags" : [
        {
          "key" : "span.kind",
          "type" : "string",
          "value" : "server"
        },
        {
          "key" : "internal.span.format",
          "type" : "string",
          "value" : "zipkin"
        }
      ],
      "process" : {
        "serviceName" : "transaction-manager",
      }
    }
  }

我的目标是找到带有标签[“internal.span”]“zipkin”的条目。字段“标签”是“嵌套的”。我正在尝试像下面这样的查询。我没有受到打击。我错过了什么?

{
  "from": 0,
  "size": 1,
  "query": { 
          "bool": {
              "must": [ 
                  {"match": { "process.serviceName": "transaction-manager" }},
                  {
                          "nested": {
                              "path": "tags",
                              "query": {
                                  "match": {
                                      "value": "zipkin"
                                  }
                              }
                          }
                  }
              ]
          }
      }
}

【问题讨论】:

    标签: elasticsearch search jaeger


    【解决方案1】:

    您只需要在匹配查询中使用tags.value 而不是value

    以下查询应该会有所帮助:

    POST <your_index_name>/_search
    {
      "from": 0,
      "size": 1,
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "process.serviceName": "transaction-manager"
              }
            },
            {
              "nested": {
                "path": "tags",
                "query": {
                  "match": {
                    "tags.value": "zipkin"        <---- Note this
                  }
                }
              }
            }
          ]
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-02
      • 2023-04-05
      • 2022-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多