我对Searchkick有问题。 当我发送这样的查询
Row
Searchkick发送带有许多类似查询的请求
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name]
)
但是当我将查询更改为
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":[]}'
Searchkick仅发送两个查询来发送该请求
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
match: :word_start
)
“ searchkick”,“ 1.3.5”
“ rails”,“ 4.1.5”
elasticsearch 1.7.4
如何解决此问题并仅发送一个查询?
答案 0 :(得分:0)
需要将misspellings: false
添加到这样的搜索方法
Position.search(
query.downcase,
fields: [:name],
include: [:brand],
where: {},
per_page: 40,
page: 1,
order: [:name],
misspellings: false,
match: :word_start
)