I have problem with the term query in elasticsearch. I send the following query:
{
"query": {
"term": {
"title":"Test1"
}
}
}
I have an empty result:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
But if I send the following:
{
"query": {
"term": {
"root":true
}
}
}
I have:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 0.2876821,
"hits": [
{
"_index": "content_2018-05-30-092148",
"_type": "topic",
"_id": "6064f7ac-63d5-11e8-adc0-fa7ae01bbeb1",
"_score": 0.2876821,
"_source": {
"_meta": {
"model": "Secafi\\Content\\Topic"
},
"id": "6064f7ac-63d5-11e8-adc0-fa7ae01bbeb1",
"title": "Test2",
"root": true
}
},
{
"_index": "content_2018-05-30-092148",
"_type": "topic",
"_id": "6064f7ac-63d5-11e8-adc0-fa7ae01bbeb2",
"_score": 0.2876821,
"_source": {
"_meta": {
"model": "Secafi\\Content\\Topic"
},
"id": "6064f7ac-63d5-11e8-adc0-fa7ae01bbeb2",
"title": "Test3",
"root": true
}
},
{
"_index": "content_2018-05-30-092148",
"_type": "topic",
"_id": "6064f7ac-63d5-11e8-adc0-fa7ae01bbebc",
"_score": 0.2876821,
"_source": {
"_meta": {
"model": "Secafi\\Content\\Topic"
},
"id": "6064f7ac-63d5-11e8-adc0-fa7ae01bbebc",
"title": "Test1",
"root": true
}
}
]
}
}
I have the same result if I do a match query on the title field, it never returns any document.
What's wrong. Why the first query doesn't return the document Test1?