Elasticsearch QueryStringBuilder using wildcards

I am using elasticsearch2.3.2 in which I stumbled on the following use case where we are not getting the expected result while using QueryStringBuilder.
Following is an example of what we did,

1) Created an index with following settings

curl -XPUT 'http://localhost:9200/test/' -d '{
"mappings": { 1: {"dynamic": "strict","properties": {"field": {"type": "string","index": "not_analyzed","fielddata": {"format": "doc_values"}}}}},
"settings" : { "index" : { "number_of_shards" : 1,"number_of_replicas" : 1 } }
}'

2) Indexed a document

curl -XPUT 'http://localhost:9200/test/1/1' -d '{ "field" : "(/sheet|)/published/(o|e)/(([0-9]{1,19})|([a-zA-Z0-9\._\*\-%]+))" }'

3) Ran a search on the index

curl -XGET 'http://localhost:9200/test/1/_search'?pretty -d '{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": " ((field:\(\/sheet|\)\/published\/\(o|e\)\/\(\(\[0\-9\]\{1,19\}\)|\(\[a\-z*))"
}
}
],
"minimum_should_match": "1"
}
}
}'

gives the following result

{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "1",
"_id" : "1",
"_score" : 1.0,
"source" : {
"field" : "(/sheet|)/published/(o|e)/(([0-9]{1,19})|([a-zA-Z0-9\.
\*\-%]+))"
}
} ]
}
}

4) While running another query

curl -XGET 'http://localhost:9200/test/1/_search'?pretty -d '{
"query": {
"bool": {
"must": [
{
"query_string": {
"query": " ((field:\(\/sheet|\)\/published\/\(o|e\)\/\(\(\[0\-9\]\{1,19\}\)|\(\[a\-zA*))"
}
}
],
"minimum_should_match": "1"
}
}
}'

gives no matched result

{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

Am I missing anything here?

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