I have a problem with Searchkick. When I send query like this
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name]
)
Searchkick send request with many queries like this
http://127.0.0.1:9200/positions_development/_search?pretty -d '{"query":{"dis_max":{"queries":[{"match":{"name.analyzed":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_search"}}},{"match":{"name.analyzed":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_search2"}}},{"match":{"name.analyzed":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_search","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}},{"match":{"name.analyzed":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_search2","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}}]}},"size":40,"from":0,"sort":{"have_price":"desc"},"facets":{},"timeout":"11s","fields":[]}'
But when i change query to
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
match: :word_start
)
Searchkick send this request with only two queries
curl http://127.0.0.1:9200/positions_development/_search?pretty -d '{"query":{"dis_max":{"queries":[{"match":{"name.word_start":{"query":"fly","boost":10,"operator":"and","analyzer":"searchkick_word_search"}}},{"match":{"name.word_start":{"query":"fly","boost":1,"operator":"and","analyzer":"searchkick_word_search","fuzziness":1,"prefix_length":0,"max_expansions":3,"fuzzy_transpositions":true}}}]}},"size":40,"from":0,"sort":{"have_price":"desc"},"facets":{},"timeout":"11s","fields":[]}'
'searchkick', '1.3.5'
'rails', '4.1.5'
elasticsearch 1.7.4
How I can fix this and send only one queryes?
Need add misspellings: false
to search method like this
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
misspellings: false,
match: :word_start
)