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

**URL:** <https://discuss.elastic.co/t/from-sql-to-es-how-to-check-if-a-parameter-is-equals-to-a-value/43404>\
**Category:** Elasticsearch\
**Created:** [March 3, 2016, 3:17pm UTC](https://discuss.elastic.co/t/from-sql-to-es-how-to-check-if-a-parameter-is-equals-to-a-value/43404 "2016-03-03T15:17:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinpereira](https://avatars.discourse-cdn.com/v4/letter/v/977dab/32.png) [@vinpereira](https://discuss.elastic.co/u/vinpereira)\
**Post date:** [March 3, 2016, 3:17pm UTC](https://discuss.elastic.co/t/from-sql-to-es-how-to-check-if-a-parameter-is-equals-to-a-value/43404/1 "2016-03-03T15:17:03Z")

</div>

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:

> <https://gist.github.com/vinpereira/4e6ce4a23f4139bc16f7>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:11pm UTC](https://discuss.elastic.co/t/from-sql-to-es-how-to-check-if-a-parameter-is-equals-to-a-value/43404/2 "2017-07-05T23:11:34Z")

</div>

Closed on July 5, 2017, 11:11pm UTC


