RDBMS Query transforms to Elasticsearch Query DSL

Hi,

I wanted to transform the RDBMS query into elasticsearch query DSL. So the RDBMS query is like below:

sum(1) where <art1> = TODAY() and <atr2> = ’K’ and  <atr3> <> 0 and <atr4> = 0

And I have transformed that above query into Query DSL like below:

GET /test-*/_count
{
               "query": {
                "bool": {
                   "must": [
                    {
                     "range": {
                        "atr1": {
                            "gte": "2022-09-22T00:00:00",
                            "lte": "2022-09-22T23:59:59"
                        }
                     }
               },
              {
                "match": {
                  "atr2": "K"
                }
              },
             {
               "query_string": {
                 "query": "NOT (atr3: 0)"
                }
             },
             {
               "match": {
                  "atr4": "0"
                }
             }
              
            ]
          }
        }

}

Is that Query DSL equivalent to RDBMS query? Have I transformed it correctly?
I am very new to this Query DSL. Can anyone help me to understand?

@stephenb , can you please check?

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