Hello , i'm trying to imrpove the search time for a text from a postgresql database using Elasticsearch , the problem is the search returns a nameof product with best score using "similarity" function in Postgresql example :
``` select p.name , similarity(p.name , 'HORTIFRUTIGRANJEIROS/PITAYA') as sml from products p order by sml desc limit 10 ```
when changed to Elasticsearch , i used the java search API :
``` MatchQueryBuilder matchQueryBuilder = new MatchQueryBuilder("name", "HORTIFRUTIGRANJEIROS/PITAYA"); matchQueryBuilder.fuzziness(Fuzziness.AUTO); searchSourceBuilder.query(matchQueryBuilder); searchSourceBuilder.sort(new ScoreSortBuilder().order(SortOrder.DESC)); SearchRequest searchRequest = new SearchRequest(); searchRequest.source(searchSourceBuilder); ```
but the order of products with score in the response is very different ,
Is there any way to find something similaire to similarity() function on Elasticsearch ? knowing that it uses the trigram for search , i found some resources about n-gram on Elasticsearch but nothing for the java search API .