Not equal to function

Hi All,

I have a fields called subject.Account name and Target.account name , sometimes both have same values like

subject.Accountname : abc11
subject,Targetname : abc11

sometimes both values will be different like,

subject.Accountname : xyz34
subject.Targetname : abc12

Is it possible to right a query like Where Target Account name
Is not EQUAL to Subject Account Name , i need to have the values of that alone.

Any help much appreciated :slight_smile:

Thanks in advance,
Raj

You can do it with a script query but it won't be able to use the index. If need to do this quickly then you should add a flag to the documents with the same accounts at ingest time. If you don't care about how slow the query is then go for the script query.

thank you very much for the reply,do you have any example query for this , if possible :slight_smile:

I don't have an example handy but it'd look something like:

POST /test/_search
{
  "query": {
    "script": {
      "inline": "doc['Accountname'].value == doc['Targetname'].value"
    }
  }
}
1 Like

thank you Nick

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