{"comment":{"url":"https://api.github.com/repos/medcl/elasticsearch-analysis-ik/comments/12583895","html_url":"https://github.com/medcl/elasticsearch-analysis-ik/commit/86813f5be9bf52375f5fb58d468737d7b165e667#commitcomment-12583895","id":12583895,"user":{"login":"shikui","id":11955133,"avatar_url":"https://avatars.githubusercontent.com/u/11955133?v=3","gravatar_id":"","url":"https://api.github.com/users/shikui","html_url":"https://github.com/shikui","followers_url":"https://api.github.com/users/shikui/followers","following_url":"https://api.github.com/users/shikui/following{/other_user}","gists_url":"https://api.github.com/users/shikui/gists{/gist_id}","starred_url":"https://api.github.com/users/shikui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shikui/subscriptions","organizations_url":"https://api.github.com/users/shikui/orgs","repos_url":"https://api.github.com/users/shikui/repos","events_url":"https://api.github.com/users/shikui/events{/privacy}","received_events_url":"https://api.github.com/users/shikui/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"86813f5be9bf52375f5fb58d468737d7b165e667","created_at":"2015-08-07T10:05:54Z","updated_at":"2015-08-07T10:05:54Z","body":"我的使用场景：在 nginx 下放了一个名为 elastic_words.txt 的文件来保存热词。\r\n\r\n如果去掉这里的304处理，当 elastic_words.txt 没有更新时，会持续往 elasticsearch 日志文件里写入如下的信息，每分钟一条：\r\n[INFO ][ik-analyzer] remote_ext_dict http://HOST_NAME/elastic_words.txt return bad code 304\r\n\r\n之所以加上 304 的处理，是因为：根据代码逻辑，返回200和304，都会检查 Last-Modified 和 ETag，而 web server 返回304时，其 Last-Modified 和 ETag  都是没有变化的，因为不会发生更新行为，也不会输出日志。\r\n\r\n当然，如果不是用静态文件，而是通过 PHP 或其他动态脚本动态返回热词和控制 header，倒是可以返回 200 并使其 Last-Modified 和 ETag 保持不变，以避免返回 304 导致大量日志信息的问题，但是这样就丧失了对使用静态热词文件这一场景的兼容。\r\n\r\n所以，建议还是加上304。"}}