Can I implement match phrase or limit the query result score?

as you can see, from query preview from my console above, I type "masjid istiqlal" as the query and there is 2 result documents appear (in fact, I only have 2 documents in my engine), the first document score is 32.44 and the second document score is 1.34, both documents also appears if I access it through Restful API.

the first document is exactly the document that I want, but unfortunately the second document is also appear on my query result. actually I only wanna show 1 document for query "masjid istiqlal". the second document appears because there is "masjid" in some fields in the document.

so to solve this issue, I want to implement match phrase, I mean, I want to show document that has exact match phrase "Masjid Istiqlal", not only "Masjid" or "Istiqlal". how to do that ?

or I assume that I can limit the score, I mean, only show the document that has score more than 2.5. something like that so I can prevent the second document to show if I perform search through Restful API. can I do that ?

Hey @monit_pakubuwono,

so to solve this issue, I want to implement match phrase, I mean, I want to show document that has exact match phrase "Masjid Istiqlal", not only "Masjid" or "Istiqlal". how to do that ?

You could do that by surrounding the search term with quotes, which is described here as part of the Lucene Query Syntax: Search | Elastic App Search Documentation [7.9] | Elastic.

That may be case sensitive, in which case you may want to consider downcasing both your search term and your venue field.

or I assume that I can limit the score, I mean, only show the document that has score more than 2.5. something like that so I can prevent the second document to show if I perform search through Restful API. can I do that ?

There is currently no way to set a minimum score.

Hope that helps, let me know if you have any further questions.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.