Regular expression query

Hi, i have data as below in my elastic

'My ORDER NO. 013-2009-01 and the order date is March 11, 2009 and delivered date is 13-03-2009 and the product id is B-43.'

I am using regular expression query to get the data from index, i used following query and i am unable to get the data from index due to special characters in order no.

Can anyone help, how to handle special characters in the text in Elasticsearch to retrieve the data.

GET index_name/_search
{
"_source": ["file.filename"],
"query": {
"regexp": {
"content": "013-2009-01"
}
},
"highlight": {
"fields": {
"content": {}
}
}
}

Hi @Krishna_Sai_Nag_G. Are you sure you need to use a regular expression query? You don't appear to be using a regular expression in the example.

If you definitely need to use a regexp query, you need to set the correct parameters for your field (content). You currently have a string where it should be an object.

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