I have FNAME and LNAME and Address that I want to search on. 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%
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
and when I try to add LName and Address
'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:
$params = [
'index' => $this->arrayES['index'],
'type' => $this->arrayES['type'],
'body' => [
'query' => [
'query_string' => [
'query' => 'FName:Jo* AND LName:ro* AND Address:34*'
]
]
]
];