I am using Grails-ElasticSearch Plugin(0.0.2.5). I want to add a constraint to my domain instances before it is indexed in ElasticSearch.
Example:- I have a domain class A with a field 'status', i want to add an abstraction between Database and ElasticSearch i.e, all the instances should be populated in the Database but instances with ACTIVE status should be sent to elasticsearch.
Please suggest if this is possible?
Thanks, Karan
The simplest approach is to add all the records in the index, and then query using a Filtered Query using a filter like term("status","active"). Since the filtered query just clean all the non matching results before calculating the scores, it should not affect the performance in a significant way. A little more complex approach is to fork the repo and add an specific interceptor property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With