【问题标题】:Retire nested filter wrong argument退出嵌套过滤器错误参数
【发布时间】:2014-02-23 22:17:00
【问题描述】:

我想做嵌套过滤。但是返回错误。还有其他过滤方法吗?这个真的用吗?

错误输出: 错误的参数过滤器

/models/series/filter_season 方法:

def self.filter_season
    s = Tire.search('myindex', type: 'series') do
      query do
        filtered do
          query do
            all
          end
          filter do
            nested do
              path 'seasons'
              query do
                bool do
                  must do
                    term 'seasons.title', 'season 5'
                  end
                end
              end
            end
          end
        end
      end
    end
    s.results.each do|result|
      puts result.title
    end

结束

映射设置:

  index_name 'myindex'
  mapping do
    indexes :id, type: 'integer'
    indexes :title, type: 'string'
    indexes :seasons, type: 'nested' do
        indexes :id, type: 'integer'
        indexes :title, type: 'string'
    end
  end

【问题讨论】:

    标签: ruby-on-rails elasticsearch tire


    【解决方案1】:

    请看下面关于问题Nested query with filters test integration的回答

    filter 方法需要至少一个参数,在您的情况下它接收 0。因此,错误。

    希望这篇文章有助于解决您的问题。

    【讨论】:

    • 感谢您的回答。工作过
    • @AhmetKAPIKIRAN 很高兴为您提供帮助。 :)
    猜你喜欢
    • 2021-06-01
    • 2017-01-28
    • 2019-07-19
    • 1970-01-01
    • 2022-08-19
    • 2017-07-27
    • 1970-01-01
    • 1970-01-01
    • 2021-08-26
    相关资源
    最近更新 更多