Kibana querying for string length

后端 未结 3 1604
南旧
南旧 2021-01-14 14:51

Is there a way to query for a value of a certain length in Kibana?

For example, given the following two KV pairs:

key: \"some\"
key: \"something\"
         


        
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 15:08

    You can use script query to do that in Kibana. Script Query in Kibana, There is an example for script query with key's length more than 5:

    {
        "query": {
            "filtered": {
                "filter": {
                    "script": {
                        "script": "doc['key'].getValue().length() > 5"
                    }
                }
            }
        }
    }
    

    And also you need to enable script search in elasticsearch, you need to add the below config into elasticsearch.yml:

     script.engine.groovy.inline.search: on
    

提交回复
热议问题