Saving queries, with nested ANDs and ORs, in Elastic Search for runtime evaluation

Problem statement:

I have a few hundred entities with certain criteria associated with them. These criteria can be nested with ANDs and ORs. For a given input, entities which satisfy the conditions would be filtered out and used a response.

I have documents each with conditions or criteria which they need to satisfy to be part of the response based on values provided at runtime.

How can I achieve this with elastic search?

It is not entirely clear what you are asking, so an example would help.

Say for eg, I have 2 documents which can be only seen by people who satisfy the given criteria

  1. doc_1 : user needs to be logged in to the system AND he needs to be living in X area and should have Y balance in his wallet.
  2. doc_2 : user needs to be living in X' area and should not have any complaints in the system in the last Z' days.

The above would be predefined and stored in the system.

The score of each document is evaluated by adding the score for each criteria in the doc using the following formula:
User Area Criteria: fixed_number1 * user score in the system
Current Wallet Criteria: fixed_number2 * (Money spent in last month/Current balance in wallet)
Complain Criteria: fixed_number3 * total complains in last month

At runtime, the input would be the user information like

  1. In which area is he located now
  2. What is his current wallet balance
  3. The last date when the complain was registered against him in the system.
  4. User score
  5. Ratio of Money spent in last month and Current balance in wallet
  6. Total complains in last month

We have analyzed percolate API but are facing an issue : Passing value of Variables at runtime in Percolate API

Apart from Percolate API, is there any other solution in elastic search?

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