Filters based on business logic after usual search query

As part of our development , we have to apply some business rules like whether user has viewing rights to the search string or not.

The elastic query we form applies the query criteria given by the user and search elasticsearch and gets search results and aggregations on it. Now , if we apply the filter conditions after elastic results are fetched , then we will have to compute the aggregations against based on the results which don't make the cut. The filter criteria is given by a service and may not entirely present in the dataset.

How can i work around this problem besides computing aggregations based on records eliminated.

If you want Elasticsearch to take care of it, you have to put all the data required for processing into Elasticsearch.

You could try to write a custom java plugin and hook into certain parts of Elasticsearch but this is some serious work.

If you need some sort of user or role based filtering, you might want to take a look at x-pack security

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