I am using Elasticsearch in my application to search for a matching word anywhere in a table.
This is the query string i have used to fetch my result:
search({ query: { prefix: { _all: keywords }}, sort: [ { start_date: 'asc', start_time: 'asc' } ] })
The selected records were then being queried with the dates to match the date range(s) specified in the application, by the following query:
where("status_id= ? and active=? and (((start_date >= ?) and (start_date <= ?))
or ((start_date <= ?) and (? <= end_date)))",2,true,range_start_date,
range_end_date,range_start_date,range_start_date)
But i know this is not a good way to fetch results. Now i want to modify this to fetch just the required data from elasticsearch index.
After a long search i found "query_string" and "simple_query_string" to match my requirement. But i am unsuccessful till now to get the required result.
How can i append the query with the elasticsearch result to get the required records? Can someone please help?
Thanks in advance.