[英]elasticsearch php multiple names
I have FNAME and LNAME and Address that I want to search on. 我有要搜索的FNAME和LNAME以及地址。 I want to search 我要搜寻
FName = jo
LName = ro
Address = 34
that should give me all the records that have FName and LName starting with jo and ro (LIKE) so if it was mysql it would be FNmae Like jp% And LName Like ro% AND Address Like 34%
那应该给我所有以jo和ro(LIKE)开头的FName和LName的记录,所以如果是mysql,它将是FNmae Like jp% And LName Like ro% AND Address Like 34%
so I have so far this 所以我到目前为止
$params = [
'index' => $this->arrayES['index'],
'type' => $this->arrayES['type'],
'body' => [
'query' => [
'match' => ["FName"=>"Jo"]
]
]
];
Problem with that is that it gives me only JO 问题是它只给我JO
and when I try to add LName and Address 当我尝试添加LName和地址时
'match' => ["FName"=>"Jo", "LName"=>"ro", "Address"=>"34"]
that errors out. 那个错误出来了。
Need some help 需要一些帮助
thanks 谢谢
** Expected Results ** ** 预期成绩 **
FName LName Address
Jo Ro 34 W Ave
John Rosa 3456 Havana Ave
Johnny Ronnatte 341 House Rd
There's a way which allows to specify a very similar query to your SQL query, using the query_string
query : 有一种方法可以使用query_string
查询指定与SQL查询非常相似的查询 :
$params = [
'index' => $this->arrayES['index'],
'type' => $this->arrayES['type'],
'body' => [
'query' => [
'query_string' => [
'query' => 'FName:Jo* AND LName:ro* AND Address:34*'
]
]
]
];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.