在ElasticSearch

时间:2015-07-28 21:47:44

标签: elasticsearch elasticsearch-plugin

是否有办法强制为每个查询执行(查询)过滤器,而不管它是否存在于搜索查询请求中?在我的例子中,我有一个本机搜索脚本,用于根据动态变化列表过滤文档,该列表在elasticsearch实例之外维护。由于我不控制查询服务器的所有客户端,我不能保证他们将正确地进行过滤或在请求中添加对脚本的引用,因此希望强制在ES服务器本身内执行过滤器。这(很容易)是否可以实现? (我使用的是ES 1.7.0 / 2.0)

TIA

2 个答案:

答案 0 :(得分:1)

If users can submit arbitrary requests to the cluster, then there is absolutely nothing that you can do to stop them from doing whatever they want to do.

You really only have two options here:

  1. If users can select arbitrary queries/filters, but you control the index or indices that they go too, then you can use filtered aliases to limit what they can see.
  2. Use Shield (not free) to prevent arbitrary access to limit what indices/aliases any given request can access (with aliases using filters to hide data).

答案 1 :(得分:0)

Aliases绝对是要走的路。如果每个客户端需要不同的过滤器,请为每个客户端创建一个别名,并要求他与该别名进行通信。