我一直在使用/将字符串字段映射为索引:“not_analyzed”但仍然无法获得大写字母字符串的搜索结果?我在里面搜索了整个互联网,但没有简单的解决方法。
示例数据:
{
"job_status":"Finished",
"build_number":"94",
"build_duration":778,
"@timestamp":"1455317284293",
"build_result":"UNSTABLE",
"slave_node":"tiny-cmsbuild03",
"job_name":"DMWM-WMCore-RunTests-Oracle"
},
{
"job_status":"Finished",
"build_number":"96",
"build_duration":859,
"@timestamp":"1455662929042",
"build_result":"UNSTABLE",
"slave_node":"tiny-cmsbuild02",
"job_name":"DMWM-WMCore-RunTests-Oracle"
},
{
"job_status":"Finished",
"build_number":"89",
"build_duration":385,
"@timestamp":"1454453359226",
"build_result":"UNSTABLE",
"slave_node":"tiny-cmsbuild06",
"job_name":"DMWM-WMCore-RunTests-Oracle"
}
kibana3正在进行此查询:
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "job_name:D*"
}
}
]
}
},
"filter": {
"bool": {
"must": [
{
"match_all": {}
}
]
}
}
}
}
但没有结果
答案 0 :(得分:2)
您没有获得任何结果的原因是因为query_string
query有一个名为lowercase_expanded_terms
的参数,默认情况下为true。
它的作用是小写您传递给它的查询字符串,以便job_name:D*
变为job_name:d*
,因此没有任何匹配。
但是,如果您这样查询,即将lowercase_expanded_terms
设置为false
,它就会起作用:
curl -XGET localhost:9200/your_index/_search?lowercase_expanded_terms=false&q=job_name:D*