我有这样的测试: 我的环境:
elasticsearch-php:v2.3.0
elasticsearch-server: v1.7.1
message field text:"GET /index.php?type=bapapapahhh HTTP/1.1" 200 4906
PHP代码:
$client = Elasticsearch\ClientBuilder::create()->setHosts(['172.1.1.6:9200'])->build();
$params = [
'type' => 'nginx-80',
'body' => [
'query' => [
'bool' => [
'must' => [
['match' => ['message' => 'papapahhh']],
//['prefix' => ['message' => 'bapapapah']],
//['fuzzy' => ['message' => 'bapapa']],
]
]
]
]
];
$result = $client->search($params);
问题是,如果关键字是' bapapapahhh'消息可以匹配
但是,如果关键字是' bapapapah',则邮件不能匹配
我试过用户匹配前缀和其他人,但结果不对。
现在,我希望消息字段匹配设置关键字的内容,例如' papa' hhh',' bapa'' bapapa' 。
感谢。