I'm trying to perform a full text search. On the Elastic docs it says "Returns documents that match a provided text, number, date or boolean value. The provided text is analyzed before matching." But this is not happening on my end.
As an example lets say im trying to search for "Ferrari". But when I search on "Ferr" nothing comes up.
var response = await _elasticClient.SearchAsync<Product>(x => x
.Size(10)
.Query(q => q
.Match(m => m
.Field(f => f.Title)
.Query("Ferr"))));
But when I search on "Ferrari" it does. This does not make sense to me because that's what the Term query should do and not the Match.
I'm able to use wild cards but this is generally not as performant. This is how the data looks like
{
"_index": "product",
"_id": "33c9c3ab-0be8-4e70-83a2-1112fd528e65",
"_version": 1,
"_seq_no": 2,
"_primary_term": 1,
"found": true,
"_source": {
"id": "33c9c3ab-0be8-4e70-83a2-1112fd528e65",
"title": "Ferrari",
"description": "car",
"price": 500000,
"quantity": 100,
"timestamp": "0001-01-01T00:00:00+00:00"
}
}
I also encountered the same problem before, fuzzy query can be matched by Fuzziness.AutoLength
.
In your scenario, if you search for Ferrari
, Ferr
cannot find anything, but maybe Ferrar
can, so I think this is a problem of matching accuracy.
Related link