Sorting by number of matched terms with simple_query_string

(Emily Craps) #1


I'm implementing free text search in a web application. The user is able to search like with google, he can use the + and - signs etc. It is easy to implement with the simple_search_query and works perfectly. I am currently sorting by the relevance score provided by elasticsearch, but I want to sort on the number of matched search terms, it doesn't matter how many times a term is present in a document. It could be done like this constant score query example, but then I'll have to parse the query string in the application and split it in terms.

Is there a way to have both done by elasticsearch?

(system) #2