I'm creating a search page with Elastic search + Symfony2 using FOSElastica. I have setup repository and model transform and pagination perfectly fine.
I have geo-location search with couple of aggregation which are following
Distance Range
Duration between two points
Categories
location: geo point (default is set by country)
There will be multiple aggregation click by user to filter their data to narrow the data. What would be the best way to track which aggregation is active by the user?
And how can I show send and receive filter aggregation between controller and service methods?
Would it be best to just track everything by session?
Since the default Elasticsearch response doc does not contain the query that was submitted, you'll need to keep track of the filter selection state in a MVC application in order to properly render your filter controls.
Some options:
Once you've submitted a search request, your controller which calls Elasticsearch, is now responsible for passing the user's filter selection state to Elastica (and also back to the view along with search results)
This sort of echoing filter state back from the search controller is useful especially when you need to redraw the section of the page housing search filters.