question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Uppercase Regex in String queries search

See original GitHub issue

Regex search on analyzed fields doesn’t work with capital letters now as if the analyzer saves them lower cased, or doesn’t use the standard analyzer for some reason.

To Reproduce Steps to reproduce the behavior:

  1. Create an index and add a doc containing uppercase letters to it (e.g message: this is a TLS handshake)
  2. Perform this search request: {"query": {"bool": {"must": [{"query_string": {"query": "message:/TLS/"}}]}}}

Expected behavior We should find the doc we added above since it’s an exact match. However, we got 0 results.

Plugins None

Host/Environment (please complete the following information): I used OpenSearch container with a single node (version 1.2.3), running on iOS 11.6.4

Additional context If we specify the standard analyzer to the search request, we get the expected results. {"query": {"bool": {"must": [{"query_string": {"query": "message:/TLS/", "analyzer":"standard"}}]}}}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:24 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
alexgnatyukcommented, Jul 4, 2022

@reta @nknize we believe that reverting the change (aligning the behavior with the way it worked before the fix) should be the way to go in this case because:

  1. the initial fix was needed only for fields with the type of wildcard, which OpenSearch doesn’t support. There is no real reason for this code to exist in the OpenSearch.
  2. the fix changes make the regex search case sensitive in a very weird way since we don’t automatically apply type-specific analyzers at a search time for regex anymore, although we do it on indexing time by default.
  3. the fix introduces an inability to apply type-specific analyzers during the query string regex searches (even if set on an index or type mapping level), which reduces the opportunities to affect the query parsing and search flow in general.

please let me know what you think about it.

and we of course happy to contribute to it if that’s the way to go here.

@AmiStrn FYI

2reactions
retacommented, Jul 5, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to check for uppercase letters in MySQL? - Stack Overflow
SELECT * FROM `users` WHERE `email` REGEXP BINARY '[A-Z]';. Using the above example, you'd get a list of emails that contain one or...
Read more >
Regular expression syntax - Adobe Support
The regular expression [A-Z][a-z]* matches any sequence of letters that starts with an uppercase letter and is followed by zero or more  ......
Read more >
Case Insensitive Search with Regex - Atlas Triggers & Functions
I am trying to do a case-insensitive search using Regex - the documentation gives examples with literal strings but I am trying this...
Read more >
Find upper case / lower case letters using Regex
Hi, I'm having trouble catching l/u case letters using regex expressions in Publisher. I try to use several syntaxes.
Read more >
String functions | BigQuery - Google Cloud
Google Standard SQL for BigQuery supports string functions. ... In the following query, an error is thrown because the search value cannot be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found