考慮,這是我的映射和設置區分大小寫的搜索不工作
$arr = [
'index' => 'test1',
'body' => [
'settings' => [
'analysis' => [
'analyzer' => [
'name_analyzer' => [
'type' => 'custom',
'tokenizer' => 'standard',
'filter' => [
'lowercase',
'asciifolding',
'word_delimiter'
]
]
]
]
],
"mappings" => [
"info" => [
"properties" => [
"Name" => [
"type" => "string",
"index" => "analyzed",
"analyzer" => "name_analyzer"
],
"Address" => [
"type" => "string",
"index" => "analyzed",
"analyzer" => "name_analyzer"
]
]
]
]
]
];
後指數兩名&地址爲
- ABC some_address1
- 美國廣播公司some_address2
時我搜索名字'A',我沒有得到任何結果的文件。
但是當我搜索名稱'a'我得到的結果中的文件
所以我的問題是即使我已設置分析器爲什麼我的搜索不區分大小寫?
我的搜索查詢
$query['index'] = 'test1';
$query['type'] = 'info';
$query['body'] = [
'query'=> [
'bool' => [
'should' => [
[
'prefix' => [
'Name' => 'a'
]
]
]
]
]
];
請出示您的實際代碼 – RiggsFolly
如果您發佈查詢這將是有益的:
如果這不是一個選項,您可以按如下方式使用一個query string用通配符。有些查詢,如術語查詢,在查詢時不會通過分析器,因此您不會得到任何結果。 – moliware