Hi,
I have a problem formulating my search query. Could someone please
give me advice how to fix the following test case so that I find a
result every time? Query string is variable for me. Searching by _id
and padding _id with zeros is mandatory for the application from which
I extracted this use case.
$curl -X PUT "http://devel1:9200/test" -d '{"mappings" : {"item":
{"_id":{"index":"not_analyzed","store":"yes"},"properties":{"str":
{"type":"string"}}}}}'
$curl -X PUT "http://devel1:9200/test/item/0001" -d '{"item":{"str":"a
malibu house"}}'
$curl -X POST "http://devel1:9200/test/_search" -d '{
"query": {
"query_string": {
"query": "a house",
"default_operator": "AND"
}
}
}'
=> OK, 1 hit. However the fields property has been omited from the
query.
$curl -X POST "http://devel1:9200/test/_search" -d '{
"query": {
"query_string": {
"query": "a house",
"fields": [
"_id",
"str"
],
"default_operator": "AND"
}
}
}'
=> No hits
$curl -X POST "http://devel1:9200/test/_search" -d '{
"query": {
"query_string": {
"query": "a house",
"fields": [
"str"
],
"default_operator": "AND"
}
}
}'
=> OK, 1 hit. I left out the _id field
$curl -X POST "http://devel1:9200/test/_search" -d '{
"query": {
"query_string": {
"query": "a",
"fields": [
"_id",
"str"
],
"default_operator": "AND"
}
}
}'
=> No hits
Thanks in advance,
Radek