I've inserted a document with a raw_id field equal to 1.2.3.04ABC, and I'm trying to construct a regular expression query to search the document in ES. I'm using the following query:
curl -X POST 'http://localhost:9200/hello/world/_search' -d '{
"query": {
"regexp": {
"raw_id": "1\\.2\\.3\\.04ABC"
}
}
}'
This returns the result empty result
{
"took":1,
"timed_out":false,
"_shards": {
"total":5,
"successful":5,
"failed":0
},
"hits": {
"total":0,
"max_score":null,
"hits":[]
}
}
On the other hand, when I use the slightly modified query
curl -X POST 'http://localhost:9200/hello/world/_search' -d '{
"query": {
"regexp": {
"raw_id": "1\\.2\\.3.*"
}
}
}'
I get the nonempty result:
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [
{
"_id": "adfafadfafa",
"_index": "hello",
"_score": 1.0,
"_source": {
"raw_id": "1.2.3.04ABC"
},
"_type": "world"
}
],
"max_score": 1.0,
"total": 1
},
"timed_out": false,
"took": 2
}
Can someone please help me understand why the first query doesn't work?
raw_id.