My index test has the next mapping:
{
"test" : {
"mappings" : {
"_doc" : {
"properties" : {
"bar" : {
"type" : "keyword"
},
"baz" : {
"type" : "long"
},
"foo" : {
"type" : "object",
"enabled" : false
}
}
}
}
}
}
The index has 2 documents:
{
"total": 2,
"max_score": 1.0,
"hits": [
{
"_index": "test",
"_type": "_doc",
"_id": "1",
"_score": 1.0,
"_source": {
"baz": 123,
"bar": [
"php",
"python"
],
"foo": {
"1": "bla",
"2": "blu"
}
}
},
{
"_index": "test",
"_type": "_doc",
"_id": "2",
"_score": 1.0,
"_source": {
"baz": 123,
"bar": [
"java",
"python"
],
"foo": {
"3": "blue",
"4": "blae"
}
}
}
]
}
I want to get only the docs that contain key 1 in the field foo. (So in my case this is a document where _id = 1).
Which query is suitable for this?
Elasticsearch version 6.5