How to filter by field values in ElasticSearch?

Viewed 6115

Given the ElasticSearch document below:

{
    "_id": "3330481",
    "_type": "user",
    "_source": {
        "id": "3330481",
        "following": ["1", "2", "3", ... , "15000"]
    }
}

For a given user list ["50", "51", "52"] I want to check which ones are followed by the user with id 3330481. Since she is following 15000 users, I don't want to get the whole list and then check it locally.

Is there any way to retrieve only the relevant users?

2 Answers
Related