Hi Clint,
thanks for this information. Then I will use the query_string query for my
purpose.
Until I don't use the wildcard as first character this search behaves
exactly as I want.
A search for 0*0 matches document 00.
A search for 0* matches document 0*0.
A search for 10 delivers document 010.
But
A search for *0 delivers both documents 010 and 00.
A search for * delivers both documents 010 and 00.
Is this behavior intended? Or is this a bug? Or am I doing something wrong?
curl -XPUT http://localhost:9200/index/type/1 -d '{ "name": "010" }'
curl -XPUT http://localhost:9200/index/type/2 -d '{ "name": "0*0" }'
echo
echo "###############################################################"
echo "wildcard-query: one result, ok, works as expected"
curl -XGET http://localhost:9200/index/type/_search?pretty=true -d '{
"query" : { "query_string" : {
"default_field" : "name",
"query" : "0\*0"
} }
}'
echo
echo "###############################################################"
echo "wildcard-query: one result, ok, works as expected"
curl -XGET http://localhost:9200/index/type/_search?pretty=true -d '{
"query" : { "query_string" : {
"default_field" : "name",
"query" : "0\**"
} }
}'
echo
echo "###############################################################"
echo "wildcard-query: one result, ok, works as expected"
curl -XGET http://localhost:9200/index/type/_search?pretty=true -d '{
"query" : { "query_string" : {
"default_field" : "name",
"allow_leading_wildcard" : "true",
"query" : "*10"
} }
}'
echo
echo "???????????????????????????????????????????????????????????????"
echo "wildcard-query: one result, not ok, returns all documents"
curl -XGET http://localhost:9200/index/type/_search?pretty=true -d '{
"query" : { "query_string" : {
"default_field" : "name",
"allow_leading_wildcard" : "true",
"query" : "*\*0"
} }
}'
echo
echo "???????????????????????????????????????????????????????????????"
echo "wildcard-query: one result, not ok, returns all documents"
curl -XGET http://localhost:9200/index/type/_search?pretty=true -d '{
"query" : { "query_string" : {
"default_field" : "name",
"allow_leading_wildcard" : "true",
"query" : "*\**"
} }
}'
Best Regards,
Daniel