[英]How do I search for a “-” in a field value in kibana?
Here is the mapping for this field: 这是此字段的映射:
"username": {
"type": "text",
"norms": false,
"fields": {
"keyword": {
"type": "keyword"
}
}
},
I have a field that occasionally has the value of "-": 我有一个字段,有时值是“-”:
I clicked "filter for value" and this is the filter it created: 我单击“价值过滤器”,这是它创建的过滤器:
But when I do searches for this value it says not results found. 但是,当我搜索此值时,它说未找到结果。
How do I escape the "-"? 如何逃脱“-”?
I tried "\\-" but no dice 我尝试过“ \\-”但没有骰子
I tried check if the value "exists" as suggested but this also returns 0 results: 我尝试检查值是否“建议”存在,但这还会返回0个结果:
Also tried !(_exists_:"username")
in the kibana search bar and that also returns 0 results. 在kibana搜索栏中也尝试过
!(_exists_:"username")
,它还会返回0个结果。
Also running (_exists_:"username")
included docs with and without a value for the username field 也正在运行
(_exists_:"username")
包含文档的(_exists_:"username")
,该文件包含和不包含值
I also tried this which returns 0 results: 我也尝试过此方法,它返回0个结果:
(_missing_:"username")
As your username
field is of text
type and analyzed with standard analyzer , the inverted index will have no tokens for username
where as username.keyword
is of keyword
type it will have the exact value -
in inverted index. 由于您的
username
段为text
类型,并使用标准分析器进行了分析 ,因此反向索引将没有username
标记,其中,作为username.keyword
。 keyword
是keyword
类型,它将具有确切的值-
反向索引。
You can search it in following ways: 您可以通过以下方式进行搜索:
From Kibana search bar: 在Kibana搜索栏中:
username.keyword: "-"
From Kibana filter: 从Kibana过滤器中:
{ "term": { "username.keyword": "-" } }
From Sense plugin: 从Sense插件中:
GET _search { "query": { "term": { "username.keyword": "-" } } }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.