Hey! I just ran into this, too. Same kind of sub-field situation.
I understand that dots were disallowed because they could be confused with fields. But this is a field, right? "world" is a field of "hello", so the dot syntax should make sense to Elasticsearch?
tldr: change terms to term
I tried this query:
{
"query": {
"term": {
"hello.world": "foo"
}
}
}
and it worked,
{
"took": 8,
"timed_out": false,
"_shards": {
"total": 4,
"successful": 4,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.30685282,
"hits": [
{
"_index": "ave_perc_test",
"_type": "apt_type_1",
"_id": "1",
"_score": 0.30685282,
"_source": {
"hello": {
"world": "foo"
}
}
}
]
}
}
So then I tried that as a percolator:
curl -XPUT 'https://host/ave_perc_test/.percolator/1' -d '{
"query": {
"term": {
"hello.world": "foo"
}
}
}'
and got
{
"_index": "ave_perc_test",
"_type": ".percolator",
"_id": "1",
"_version": 1,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"created": true
}
Awesome! Then I percolated the doc and got:
{
"took": 52,
"_shards": {
"total": 4,
"successful": 4,
"failed": 0
},
"total": 1,
"matches": [
{
"_index": "ave_perc_test",
"_id": "1"
}
]
}
So, there ya go. Just use term if you have a subfield?
-ave