这是分析器和我最终遇到的查询:
{ "mappings": { "event": { "properties": { "ipaddress": { "type": "string" }, "hostname": { "type": "string", "analyzer": "hostname_analyzer", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } } } } }, "settings": { "analysis": { "filter": { "hostname_filter": { "type": "pattern_capture", "preserve_original": 0, "patterns": [ "(\p{Ll}{3,})" ] } }, "analyzer": { "hostname_analyzer": { "type": "custom", "tokenizer": "whitespace", "filter": [ "lowercase", "hostname_filter" ] } } } }}查询:查找以以下内容开头的主机名:
{ "query": { "prefix": { "hostname.raw": "WIN_8" } }}查找包含以下内容的主机名:
{ "query": { "multi_match": { "fields": [ "hostname", "hostname.raw" ], "query": "WIN" } }}感谢Dan帮助我朝正确的方向发展。



