比较两个值的Kibana Jmeter 板筛选器返回非法参数异常

2ic8powd  于 2022-12-09  发布在  Kibana
关注(0)|答案(1)|浏览(110)

我是Kibana的新手,我可能在这里遗漏了一些非常基本的东西。我试图使用this question中建议的筛选器来筛选整个 Jmeter 板,但我遇到了一个异常。值被设置为字符串,我无法按照异常的建议告诉在哪里设置(以及它的实际含义)
筛选条件如下:

{
  "query": {
    "bool": {
      "filter": {
        "script": {
          "script": {
            "source": "doc['server.name'].value == doc['client.name'].value",
            "lang": "painless"
          }
        }
      }
    }
  }
}

以下是例外情况:

"org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:40)",
            "doc['server.name'].value == doc['client.name'].value",
            "    ^---- HERE"
          ],
          "script": "doc['server.name'].value == doc['client.name'].value",
          "lang": "painless",
          "position": {
            "offset": 4,
            "start": 0,
            "end": 48
          },
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [server.name] in order to load field data by uninverting the inverted index. Note that this can use significant memory."
          }
        }
      },

我试着在Stack Management --〉Index Patterns --〉Pattern --〉The value www.example.com中检查是否有任何我可以设置或未正确配置的内容server.name,但我所能看到的只是它被设置为字符串。
正如我之前所说,我是Kibana的新手,但我希望“string”.equal(“other_string”)应该是一个非常通用的过滤器,没有戏剧性...我在这里错过了什么?

blpfk2vs

blpfk2vs1#

解决方案是使用完全相同的脚本,但在字段名中添加了“.keyword”。
所以改为:

"source": "doc['server.name'].value == doc['client.name'].value"

我现在用途:

"source": "doc['server.name.keyword'].value == doc['client.name.keyword'].value"

相关问题