I'm new to Elasticsearch and have 2 Questions:
Q1)
The following query return this result(pic):
Query:
{
"query": {
"query_string": {
"query": "china~"
}
}
}
Result:
{
"took": 12,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 3,
"relation": "eq"
},
"max_score": 1.3862942,
"hits": [
{
"_index": "demo",
"_type": "_doc",
"_id": "1",
"_score": 1.3862942,
"_source": {
"title": "Asia country: china",
"description": "Country in asia called Japan, Country in asia called china",
"created_at": "2021-05-09"
}
},
{
"_index": "demo",
"_type": "_doc",
"_id": "2",
"_score": 1.1090355,
"_source": {
"title": "Asia country: chnia",
"description": "Country in asia called Korea",
"created_at": "2021-05-09"
}
},
{
"_index": "demo",
"_type": "_doc",
"_id": "3",
"_score": 0.79423964,
"_source": {
"title": "Asia country: Japan",
"description": "Country in asia called Japan but china is the big country ",
"created_at": "2021-05-06"
}
}
]
}
}
Why the score of doc with id:2 is greater than the score of doc with id:3 ?
in doc with id:2 we have chnia
in doc with id:3 we have china
Q2)
Can i make a Wildcards+fuzzy query for best result may something like this:
{
"query": {
"query_string": {
"query": "*chin* OR chin~"
}
}
}
This query return docs that have this words : china(Wildcards), chni (fuzzy) but not return docs that have word: chnia