When i try to use "multi_match" in my project.
I find a question what is not in line with my expectations.
first,i post some data to the es cluster as follow:
POST /blogs/blog/1
{
"title":"elasticsearch match query",
"descrption":"elasticsearch match query"
}
POST /blogs/blog/2
{
"title":"elasticsearch match query",
"descrption":"i am a dog"
}
POST /blogs/blog/3
{
"title":"i am a dog",
"descrption":"elasticsearch match query"
}
POST /blogs/blog/4
{
"title":"i am a dog",
"descrption":"i am a dog"
}
then , i use the query as follow:
POST /blogs/blog/_search
{
"query": {
"multi_match": {
"query": "elasticsearch match query",
"fields": ["title","descrption"]
}
}
}
the result is :
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1.9646256,
"hits": [
{
"_index": "blogs",
"_type": "blog",
"_id": "2",
"_score": 1.9646256,
"_source": {
"title": "elasticsearch match query",
"descrption": "i am a dog"
}
},
{
"_index": "blogs",
"_type": "blog",
"_id": "1",
"_score": 0.7594807,
"_source": {
"title": "elasticsearch match query",
"descrption": "elasticsearch match query"
}
},
{
"_index": "blogs",
"_type": "blog",
"_id": "3",
"_score": 0.7594807,
"_source": {
"title": "i am a dog",
"descrption": "elasticsearch match query"
}
}
]
}
}
What i think is that the score of the result (the id=1) should be in the first. But why not ?