Filtering with elasticsearch


(Régis LE BRETONNIC) #1

Hello

I try to do something strange and to be franc I have no idea how to query it.
Basically I want to filter an array by checking if values are in ES and conserving the order...

For instance : array = [123, 832, 108, 431]
if ES has keys 431 and 832
I want to return [ 832, 431]

I know that it is not what ES is made for... But It is what I'd like to do :slight_smile:

Any idea ?


(Jaspreet Singh) #2

I'm not sure if there is anything in elasticsearch that will give you exactly that.
However, if you go via the regular query/filter route, highlights object will give you what matches. You may programatically transform it into whatever form you need it in.


(Régis LE BRETONNIC) #3

Thx... Indeed I was expecting for something simplier :slight_smile:
If I didn't find, I will do it on code side...

Regards