Ignoring the search field if left empty

(Hyun Thomas) #1

Hi everyone,

I am new to Elasticsearch and for the past few weeks, I have been wrangling with Elasticsearch to create a search functionality for the website I am creating.

At the moment, I am working on an "Advanced Search" functionality where users can search with multiple criteria. But I am not too sure on how to deal with empty fields; for example, say a user specifies field 1 and field 3 but not field 2 then I would like the search results to return results that match field 1 AND field 3 but ignore field 2. I have tried using an all indicator (i.e. * in kibana) but it doesn't seem to work on the query.

Could anyone provide some insights on how I can go about doing this?

Thank you,

(David Pilato) #2

Here is how I built an advanced search like feature in Java:

I hope this helps.

(Hyun Thomas) #3

Hey David,

Thanks for the reply.

Is there any equivalent to boolQueryBuilder or QueryBuilders in PHP?


(David Pilato) #4

This ?


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.