Converting a SQL query to Elastic Query


(Premieredigital) #1

I have the following SQL query that I'm looking to convert to ES:

UPDATE _index 
SET is_hidden = False
WHERE transaction_guid='XXX'

Is the following the closest equivalent?

body = {
  "script": {
    "lang": "painless",
    "inline": "ctx._source.is_hidden=false"
  },

  "query": {
    "match": {
      "transaction_guid": "XXX"
    }
  }
}

>>> self.es.update_by_query(body=body, doc_type='_doc', index='_index')

If not, what would be the preferred way to do the above?


(system) #2

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