hagezhou

ES 中 match 里面怎么加正则匹配

  •  
  •   hagezhou · Oct 25, 2017 · 7576 views
    This topic created in 3132 days ago, the information mentioned may be changed or developed.

    比如,我一般 match 可以这么写

    ··· { "query":{ "bool":{ "must":[ { "range":{ "timestamp":{ "gt":"now-1h" } } }, { "match":{ "info.sourceIp":{ "query":"1.191.187.3", "type":"phrase" } } }, { "match":{ "hostname":{ "query":"file2", "type":"phrase" } } } ] } } } ···

    如果 match 中加正则怎么写呢,比如要查询 hostname 中,1 开头的

    3 replies    2017-10-25 16:00:52 +08:00
    hagezhou
        2
    hagezhou  
    OP
       Oct 25, 2017
    @YuexLi 嗯,这个后来有试过,但是貌似只支持字符串?如果 mapping 里面设定的字段类型为 long,貌似不行?
    ctsed
        3
    ctsed  
       Oct 25, 2017 via Android
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2714 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 15:27 · PVG 23:27 · LAX 08:27 · JFK 11:27
    ♥ Do have faith in what you're doing.