However, I don't see an option to do this in SearchSourceBuilder. Am I missing something, or there is another Builder I should be using?
PS: The idea is that, if multiple users are interested in 1 topic, it makes sense to me to create one percolate query and save those user's metadata in the query.
The best way to achieve this is to not use the SearchSourceBuilder but use the XContentBuilder to construct the percolator query document yourself. In order to add the query you use one of the query builders and add that to the XContentBuilder under the query field.
What is the best way to extract the additional metadata later on. As far as I can see, the percolate API returns the _id field and _index field for all matched queries. Is the idea then to query the type .percolator with the returned ids, or is there a way better way?
At the moment the percolator api can only return the _index and _id of the matched queries.
At some point the percolator api will be improved to return the entire query or a part of it:
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.