gpt4 book ai didi

elasticsearch - ElasticSearch找到System.NullReferenceException,但找不到NullReferenceException-为什么?

转载 作者:行者123 更新时间:2023-12-03 01:55:20 24 4
gpt4 key购买 nike

我有一个基本的ELK堆栈,其中有多台计算机将日志推送到ElasticSearch(ES)服务器,然后使用Kibana对其进行检查。

我的问题是,我可以看到很多System.NullReferenceException匹配项,但是没有NullReferenceException匹配项,这使我感到非常困惑。

这是我要运行的查询:

GET _search
{
"query": {
"match": {
"message": "NullReferenceException"
}
}
}

结果是:
{
"took": 47,
"timed_out": false,
"_shards": {
"total": 1681,
"successful": 1681,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

但是,如果我使用以下查询:
GET _search
{
"query": {
"match": {
"message": "System.NullReferenceException"
}
}
}

我得到:
{
"took": 31,
"timed_out": false,
"_shards": {
"total": 1681,
"successful": 1681,
"failed": 0
},
"hits": {
"total": 12796,
"max_score": 1.7968642,
"hits": [
{
"_index": "logs-good-qa_849-2016.05.05",
"_type": "MobileWebService",
"_id": "28327d702db62623059027479162a3d73ef909f6",
"_score": 1.7968642,
"_source": {
"@timestamp": "2016-05-05T19:04:20.741Z",
"message": "Object reference not set to an instance of an object. \r\nSystem.NullReferenceException: Object reference not set to an instance of
...

消息列似乎已被分析。如果我请求映射:
GET logs-good-qa_849-2016.05.05/_mapping/MobileWebService

我得到这个:
# GET logs-good-qa_849-2016.05.05/_mapping/MobileWebService
{
"logs-good-qa_849-2016.05.05": {
"mappings": {
"MobileWebService": {
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "string"
},
"host": {
"type": "string"
},
"level": {
"type": "string"
},
"logger": {
"type": "string"
},
"message": {
"type": "string"
},
"path": {
"type": "string"
},
"qa_build": {
"type": "string"
},
"tags": {
"type": "string"
},
"ts": {
"type": "string"
}
}
}
}
}
}

从中我得出结论,消息字段应该已经被单词定界符打断并被索引了。据我所知 .是一个单词定界符,所以我不明白发生了什么。

有任何想法吗?

最佳答案

让我们尝试分析message字段的内容:

curl -XGET 'localhost:9200/accounts_2016_dev/_analyze?pretty' -d 'Object reference not set to an instance of an object. \r\nSystem.NullReferenceException: Object reference not set to an instance of'

我们获得的 token 之一是:
 {
"token" : "nsystem.nullreferenceexception",
"start_offset" : 57,
"end_offset" : 87,
"type" : "<ALPHANUM>",
"position" : 12
}

如您所见,该点不用作单词定界符,因为它后面没有空格。更一般而言,分析 test.dot将产生单个 token test.dot,而分析 test. dot(点后有1+空格)将产生两个 token testdot

因此,您不能仅匹配 NullReferenceException

关于elasticsearch - ElasticSearch找到System.NullReferenceException,但找不到NullReferenceException-为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37107395/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com