ES 0.14.3
The following syntax "works" (no syntax error but result is wrong, 0
when it should be 3) on _count
curl -s -XGET 'http://localhost:9200/INDEX/TYPE/_search?pretty=true' -
d '{
"filtered" : {
"query" : {
"matchAll" : {}
},
"filter" : {
"exists" : { "field" : "geoloc" }
}
}
}
output is :
{
"count" : 0,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
}
}
but fails with _search: (furthermore doesn't output a pretty result as
specified in the GET request)
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query], total failure; shardFailures {[pb8b2EvRTSmQX8numgtNFg]
[swissalive][0]: SearchParseException[[swissalive][0]:
from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n\t
"filtered" : {\n\t "query" : {\n\t\t\t\t"matchAll" : {}\n
\t },\n\t "filter" : {\n\t "exists" :
{ "field" : "geoloc" }\n\t }\n\t }\n}]]]; nested:
SearchParseException[[swissalive][0]: from[-1],size[-1]: Parse Failure
[No parser for element [filtered]]]; }{[pb8b2EvRTSmQX8numgtNFg]
[swissalive][1]: SearchParseException[[swissalive][1]:
from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n\t
"filtered" : {\n\t "query" : {\n\t\t\t\t"matchAll" : {}\n
\t },\n\t "filter" : {\n\t "exists" :
{ "field" : "geoloc" }\n\t }\n\t }\n}]]]; nested:
SearchParseException[[swissalive][1]: from[-1],size[-1]: Parse Failure
[No parser for element [filtered]]]; }{[pb8b2EvRTSmQX8numgtNFg]
[swissalive][2]: SearchParseException[[swissalive][2]:
from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n\t
"filtered" : {\n\t "query" : {\n\t\t\t\t"matchAll" : {}\n
\t },\n\t "filter" : {\n\t "exists" :
{ "field" : "geoloc" }\n\t }\n\t }\n}]]]; nested:
SearchParseException[[swissalive][2]: from[-1],size[-1]: Parse Failure
[No parser for element [filtered]]]; }{[pb8b2EvRTSmQX8numgtNFg]
[swissalive][3]: SearchParseException[[swissalive][3]:
from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n\t
"filtered" : {\n\t "query" : {\n\t\t\t\t"matchAll" : {}\n
\t },\n\t "filter" : {\n\t "exists" :
{ "field" : "geoloc" }\n\t }\n\t }\n}]]]; nested:
SearchParseException[[swissalive][3]: from[-1],size[-1]: Parse Failure
[No parser for element [filtered]]]; }{[pb8b2EvRTSmQX8numgtNFg]
[swissalive][4]: SearchParseException[[swissalive][4]:
from[-1],size[-1]: Parse Failure [Failed to parse source [\n{\n\t
"filtered" : {\n\t "query" : {\n\t\t\t\t"matchAll" : {}\n
\t },\n\t "filter" : {\n\t "exists" :
{ "field" : "geoloc" }\n\t }\n\t }\n}]]]; nested:
SearchParseException[[swissalive][4]: from[-1],size[-1]: Parse Failure
[No parser for element [filtered]]]; }]"
}
(mapping of TYPE is
{"properties":{"zip":{"type":"string"},"geoloc":
{"type":"geo_point"},"phone":{"type":"string"},"presentations":
{"properties":{"de":{"type":"string"},"it":{"type":"string"},"fr":
{"type":"string"},"en":{"type":"string"},"es":
{"type":"string"}}},"street":{"type":"string"},"localch_id":
{"type":"string"},"city":{"type":"string"},"contacts":{"properties":
{"faxes":{"type":"string"},"mobiles":{"type":"string"},"emails":
{"type":"string"},"phones":{"type":"string"}}},"updated":
{"format":"dateOptionalTime","type":"date"},"name":
{"type":"string"},"categories":{"type":"string"},"checked":
{"format":"dateOptionalTime","type":"date"}}}
)
It's me or it's a bug ?
(the output of
{
"fields" : [ "geoloc" ],
"query" : {
"matchAll" : {}
}
}'
being (simplified) :
{
"took" : 5,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 8,
"max_score" : 1.0,
"hits" : [ {
...
"fields" : {
"geoloc" : {
"lon" : 8.969346,
"lat" : 45.87649
}
}
}, {
...
"fields" : {
"geoloc" : null
}
}, {
...
"fields" : {
"geoloc" : {
"lon" : 6.146914,
"lat" : 46.202218
}
}
}, {
...
}, {
...
"fields" : {
"geoloc" : null
}
}, {
...
}, {
...
"fields" : {
"geoloc" : null
}
}, {
...
"fields" : {
"geoloc" : {
"lon" : 6.933529,
"lat" : 46.992651
}
}
} ]
}
}
)
3 entries out of 8 have a geoloc field, on the 5 without geoloc, 3
results in "geoloc" : null while the 2 others doesn't have any output
at all apart of the (_index, _type, _id, _score) tuple of course
(skipped here because not meaningful for the question).
Any reason to look for a difference there ?