代码之家  ›  专栏  ›  技术社区  ›  Kerem Sanjucta

弹性搜索正则表达式搜索

  •  2
  • Kerem Sanjucta  · 技术社区  · 6 年前

    我想用 regex 发现 html tags 在我的 nginx

    GET my-index/_search
    {
      "query": {
        "regexp": {
           "request": "script"
          }
        }
     }
    

    它每回我一次 script

    1.1.1.1 - - [18/Feb/2018:18:24:00 +0300] "GET /some/path/script-writing-i HTTP/1.1" 200 31712 0.085 0.085 ."-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "-"
    
    1.1.1.1 - - [09/Feb/2018:00:44:15 +0300] "GET /some/path\x22><script>alert(303);</script>=1 HTTP/1.1" 200 64183 0.104 0.104 ."-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)" "-"
    

    我想要的是找到带有html标记的表达式,特别是 脚本 (=)[^\n]*(<)[^\n]+(>) ,我可以找到我想要的,但是说到弹性搜索,它抛出了 query_shard_exception .

    任何建议或帮助将是伟大的!

    0 回复  |  直到 6 年前