我想用elasticsearch搜索并用php显示结果。我想在mysql中为它做部分匹配,例如:
select * from table_name where title like '%abc%'
但我的代码不起作用:
$params = [
'index' => 'my_index',
'type' => 'my_type',
'body' => [
'query' => [
'match' => [
'title' => '.*abc.*'
]
]
]
];
答案 0 :(得分:0)
我使用'匹配'代替'正则表达式'
$params = [
'index' => 'my_index',
'type' => 'my_type',
'body' => [
'query' => [
'regexp' => [
'title' => '.*abc.*'
]
]
]
];