How to search UTF-8 characters in Elastic Search

I have UTF-8 characters ingested into Elastic search. They got ingested as Json String. When I try to search the documents using Search Query I am getting Parse Error as below:

Parse Error:

reason : Cannot parse 'm-attributes.a_path_url:Gällande/PP/Batchprotocololl Kvalitetskontroll/lk000131.pdf' Lexical error at line 1 ,column 82. encountered after "/lk000131.pdf""

Search Query : http://localhost:9200/system_metadata_index/_search?q=m-attributes.a_path_url:Gällande/PP/Batchprotocololl Kvalitetskontroll/lk000131.pdf

Document in Elastic Search: a_path_url:Gällande/PP/Batchprotocololl Kvalitetskontroll/lk000131.pdf

But when I search without UTF-8 characters, search is working fine. Please guide me how to search UTF-8 characters using search query.

I searched regarding UTF-8 characters. But i could not get the right answer.

just an assumption here: maybe the URL encoding on your side is not correct. In order to rule that out, can you use a the body of a HTTP request for search and use something like this

POST system_metadata_index/_search
{
  "query" : {
    "query_string" : {
            "query" : "m-attributes.a_path_url:Gällande/PP/Batchprotocololl Kvalitetskontroll/lk000131.pdf"
     }
  }
}

Hey Alex! Thank you for your response..yeah i tried this and works like a charm..But is it a good practice to send json query over HTTP get request?

Also, I cannot use Elasticsearch 7.0 due to compatability issues with Java 1.7 in our system..So i have to send it as a URI query...

All the elasticsearch versions support this kind of query since the very early beginning.

I would always opt for the approach I outlined compared to passing the query as part of the URL and have the hassle of proper URL encoding and escaping.

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