小编fko*_*sal的帖子

如何在 ElasticSearch 中按字段值过滤?

鉴于以下 ElasticSearch 文档:

{
    "_id": "3330481",
    "_type": "user",
    "_source": {
        "id": "3330481",
        "following": ["1", "2", "3", ... , "15000"]
    }
}
Run Code Online (Sandbox Code Playgroud)

对于给定的用户列表 ["50", "51", "52"] 我想检查 ID 为 3330481 的用户关注哪些用户。由于她关注了 15000 个用户,我不想获取整个列表然后在本地检查。

有没有办法只检索相关用户?

filter elasticsearch

5
推荐指数
1
解决办法
3184
查看次数

如何在 Varnish 上缓存对象,但告诉客户端不要缓存它

我在 Varnish 上缓存产品详细信息页面,然后在产品更新时从后端服务器清除缓存。我希望我的客户永远不要在他们这边缓存这个页面,而是总是向 Varnish 询问,这样我就可以为他们提供最新的副本。

目前,我有以下 vcl_backend_response 配置:

sub vcl_backend_response {
    unset beresp.http.Set-Cookie;
    #unset beresp.http.Cache-Control;
    #set beresp.http.Cache-Control = "no-cache";

    if (bereq.url ~ "^/products/\d+/details") {
        set beresp.ttl = 1h;
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,使用此配置,客户端将响应缓存 1 小时,并且不再询问,即使缓存已在 Varnish 上清除。

如果我取消注释缓存控制相关的行,这次 Varnish 不会缓存页面并且总是从后端服务器请求一个新的副本。

这可以在 Varnish v6.0 中实现吗?

caching no-cache varnish

5
推荐指数
1
解决办法
620
查看次数

标签 统计

caching ×1

elasticsearch ×1

filter ×1

no-cache ×1

varnish ×1