Thank @Anthony for the reply. In fact my users requirements are two parts:
-
They want users to be able to search all fields (including document content) but only be able to retrieve specific fields such as file name. The current fls implementation does not allow search over excluded fields.
-
While enabling fls, they also want dls enabled so that certain departments can only search relevant documents. I guessed you answered this already and thanks for the answer.
The only way for me to satisfy the above was to create two indices ( one for read and another for browse). Each would have all documents indexed but different roles applied. I didnt use fls but rather excluded fields from the source so that all fields are indexed but not stored and thus cannot be retrieved as part of the source, as describe here _source field | Elasticsearch Reference [7.10] | Elastic
I also included dls in the roles to enable filtering based on user department. In addition, a document will be visible on read or browse index depending on user’s permission.
I guess my implementation is a bit complex and would have been simpler if combined fls and dls is possible out of the box.
Also, I think fls would have been more useful if it enables search but not retrieval of fields similar field exclusion from _source field. Currently it prevents both.
Regards