Elasticsearch case-insensitive query_string query with wildcards

前端 未结 2 531
遇见更好的自我
遇见更好的自我 2021-01-21 10:36

In my ES mapping I have an \'uri\' field which is currently set to not_analysed and I\'m not allowed to change the mapping.I wanted to search for uri parts with a query_string q

2条回答
  •  时光取名叫无心
    2021-01-21 11:37

    Try to use match query instead of query string.

    {
    "sort": [
        {
            "updated": {
                "order": "desc"
            }
        }
    ],
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "uri": "*w3\\.org\\/2014\\/01\\/a*"
                    }
                }
            ]
        }
    },
    "size": 50
    }
    

    Query string queries are not analyzed and but match queries are analyzed.

提交回复
热议问题