Jamil Khan
Jamil Khan

Reputation: 83

Searchkick / Elasticsearch exact match

I am using elasticsearch through searchkick

I have a field called "detail" thats analyzed using "standard" analyzer ... now just like in google we do "several words" search to get exact match .. can we do the same in searchkick? I am not looking for fields: [{detail: exact}, name] because then it will match the whole article ... just the term as a whole not individual words.

Upvotes: 1

Views: 2399

Answers (2)

Andrew Rozhenko
Andrew Rozhenko

Reputation: 526

It's as simple as User.search "fresh honey", match: :phrase now.

Upvotes: 3

Alexander Randa
Alexander Randa

Reputation: 870

You need to use match_phrase: true. You can see it in elastic search documentation.

But this feature not merged yet in searchkick. FYI: github pull request I think you can use monkey-patch for add feature to your project.

Upvotes: 3

Related Questions