我尝试创建一个具有以下逻辑的elasticsearch查询:按标题搜索,如果给出了记录类型,还要将其添加到查询中。我这样做了
def to_es_query
{
query: {
match: {
title_en: { query: @title }
}.merge!(optional_params)
}
}
end
def optional_params
type_param
end
def type_param
return {} unless @type
{
match: {
type: {
query: @type
}
}
}
end
我做错了什么?
答案 0 :(得分:0)
更新(之前的答案已删除,因为它错了)
在阅读了一些关于弹性搜索后,我认为这对你有用
Error 11 Could not copy "obj\x86\Debug\Inventory-Match.exe" to "bin\Debug\Inventory-Match.exe". Exceeded retry count of 10. Failed. Inventory-Match
Error 12 Unable to copy file "obj\x86\Debug\Inventory-Match.exe" to "bin\Debug\Inventory-Match.exe". The process cannot access the file 'bin\Debug\Inventory-Match.exe' because it is being used by another process. Inventory-Match
这将创建一个布尔搜索,其中所有条件必须为真