Compare two fields in a query

I'm trying to compare two fields and ensure one is greater than other. Something like this:
"doc['key1'].value > doc['key2'].value"

But this isn't working as scripting is disabled with my provider. Is there any other alternative to this?

There isn't another way to compare two values of the same document as part of your search, no.

1 Like

One work-around might be to index the difference of these two fields, and store the result in another field that you can perform range queries against. However that would require reindexing.

Why didn't I think of this... Thank you for pointing it out.:slight_smile:

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