Hi,
I hope you can help me to understand the logic behind the body queries.
Let's assume I have two entries in my Index:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 24,
"successful": 24,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "myindex",
"_type": "exampleType",
"_id": "one",
"_score": 1,
"_source": {
"identification": "identification1",
"certificate": "certificate1",
"state": "state1"
}
},
{
"_index": "myindex",
"_type": "exampleType",
"_id": "two",
"_score": 1,
"_source": {
"identification": "identification2",
"certificate": "certificate2",
"state": "state2"
}
}
]
}
}
Now I want to query the index to only get the second JSON. I know the identification I'm interested in is "identification2".
Well, should be a simple query, shouldn't it?
{
"query": {
"filtered": {
"query": {
"bool": {
"must": {
"match": {
"_type": "exampleType"
}
}
}
},
"filter": {
"term": {
"identification": "identification2"
}
}
}
}
}
(Query the index with _type = exmapletype and then filter the record with the specified identification)
I think this is as descripted in Elasticsearch -The definitive guide chapter "Filtering a query".
But the result list is empty
What am I doing wrong?
Please help me to understand