I am using Laravel together with Elasticsearch in order to search an table/type.
I have a total of 5 search filters that a user can use in order to search.
Title(string) - type(boolean) - state name(int) - city name(int) - price(int)
So the query can have 31 different combinations.
Since I cant use something like Eloquent ORM here I need to write each query for ES.
Is there a better way to do this?
Or is there some Laravel package that would let me do something like this - leave some search parameters empty and only let ES pick up those who arent empty.
'filtered' => [
'query' => [
'match' => ['title' => Input::get('query')]
],
'filter'=> [
'bool' => [
'must' => [
['term' => [ 'type' => 1] ],
['term' => [ 'state' => 22] ],
['term' => [ 'city' => ] ],
[ 'range' => [
'price' => [
'gte' => ,
'lte' => ,
]
]
]
]
]
],
],