From SQL to ES - How to check if a parameter is equals to a value

(Vinícius Pereira) #1

Hi everyone,

I'm new at ES and I have a few questions in my mind. This topic is about one of them.

In a SQL query I have a WHERE clause if this:
(eps.TEXT_ = :currentUser.customProperties.eps OR :currentUser.customProperties.eps = 'ABC')

Where :currentUser.customProperties.eps is a parameter passed through JavaScript. The left part of the OR is easy to do in ES, but how I do the right part?

Two more things: here we use Rythm Engine to include the parameter in the Query DSL, using @param_name, and the ES version is the 1.7.

My query example is above, where eps.TEXT_ at SQL is variables.rawValue in ES:

What I did was use Rythm to control the information flow using @if before the "filter":
@if (!currentUser.customProperties.eps.equals("ABC")) { // the filter with only the "term" -- without "bool" and "should" }

But is there a way to do this (or the same logic) using only ES?

Best regards and sorry my English.

(system) #2