简体   繁体   English

query_string在ElasticSearch中不适用于大写字符串

[英]query_string not working for uppercase string in ElasticSearch

'query' => array(
                    'query_string' => array(
                        'fields'=> array('name'),
                        "analyze_wildcard" => true,
                        'query' => '*tom*'
                    )
                )

I use this query phrase in php program,and It match lowercase strings, eg: tom/test/1 , but 'Tom/test/2' is not matched, I tried 'query' => ' Tom ' also not worked. 我在php程序中使用了这个查询短语,它匹配小写字符串,例如:tom / test / 1,但是'Tom / test / 2'不匹配,我尝试了'query'=>' Tom '也没有用。 Any suggestions? 有什么建议么? Thanks a lot. 非常感谢。

How about changing the line 换线怎么样

'query' => '*tom*'

to

strtolower('query') => strtolower('*tom*')

I've not tested that - so it may not work, but in theory, set both sides of the equation to lowercase and it should ignore case. 我没有测试过-因此可能无法正常工作,但从理论上讲,请将方程式的两端都设置为小写,并且应忽略大小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM