I am curious how one could efficiently filter results in a social network
using ElasticSearch. Let's say that a user wants to search for a phrase,
but only among documents authored by his friends. The user may have tens of
thousands (or more) friends which can change fairly often.
Using an OR Filter should work, but could result in huge JSON requests. A
FilterBuilder could be used instead, but does not seem very reusable. I was
not able to find the best Lucene solution, as it is not clear to me whether
a custom filter, multi phrase query, or other is best.
if the friends field is not analyzed (maybe by id?), then you can use the
terms filter, and add a term per friend. Still be long, but not as long and
more efficient then other solutions.
I am curious how one could efficiently filter results in a social network
using Elasticsearch. Let's say that a user wants to search for a phrase,
but only among documents authored by his friends. The user may have tens of
thousands (or more) friends which can change fairly often.
Using an OR Filter should work, but could result in huge JSON requests. A
FilterBuilder could be used instead, but does not seem very reusable. I was
not able to find the best Lucene solution, as it is not clear to me whether
a custom filter, multi phrase query, or other is best.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.