我要实现以下目标:

  • LogMessage不应包含too many connection
  • LogMessage必须存在。
  • LogMessage不能为contain no conn

  • 不可查询为:
     "must_not" => [
                    "regexp" =>[
                        "LogMessage" => ".*Too many connections.*"
                    ]
                  ],
                  "must_not" => [
                    "regexp" =>[
                        "LogMessage" => "^.{0,0}$"
                    ]
                  ],
    
                   "must_not" => [
                    "regexp" =>[
                        "LogMessage" => ".*no conn.*"
                    ]
                  ],
    

    但是上述方法无法正常工作。

    最佳答案

    尝试像这样:

       "must_not" => [
              [
                "regexp" =>[
                    "LogMessage" => ".*Too many connections.*"
                ]
              ],
              [
                "regexp" =>[
                    "LogMessage" => "^.{0,0}$"
                ]
              ],
              [
                "regexp" =>[
                    "LogMessage" => ".*no conn.*"
                ]
              ]
       ]
    

    关于regex - 在ElasticQuery中添加多个must_not,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42919954/

    10-10 18:16