How to use search query in case insesitive for keyword

Here is my search query used in python to find error count.

res = es.search(index="qvs-data", timeout=50000, body={
"highlight":{"pre_tags":["@kibana-highlighted-field@"],
"post_tags":["@/kibana-highlighted-field@"],
"fields":{"":{}},"fragment_size":2147483647},
"query":{"filtered":{"query":{"query_string":{"query":"
","analyze_wildcard":"true","allow_leading_wildcard":"false"}},
"filter":{"bool":{"must":[{"query":{"match":{"boardName":{"query":"p2379a","type":"phrase"}}}},
{"query":{"match":{"tag":{"query":"pll_NOT_LOCKED","type":"phrase"}}}},
{"query":{"match":{"os":{"query":"multios","type":"phrase"}}}},
{"range":{"timestamp":{"gte":startTime,"lte":"now"}}}],"must_not":[]}}}},
"fields":["*","_source"],"script_fields":{"origin":{"script":"0","lang":"expression"},"_count":{"script":"1","lang":"expression"}},"fielddata_fields":["timestamp"]})

return res['hits']['total']

I want to find error count for tag in case insensitive.
If tag is "pll_NOT_LOCKED" error count is 12
then for tag "PLL_NOT_LOCKED" error count should be 12

HI,

For case insensitive searches, you need to enable add a lower case filter for your index analyser. All the documents will be indexed in lower case. You can than use lower case filter for search analyser or query directly using lower case.

You can refer to here for an example to add lower case filter to your analyser.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.