小编tin*_*tin的帖子

Elasticsearch:嵌套字段上的多匹配查询

我在 RoR 中遇到多匹配查询的问题。我已经配置了 Elastic Search 并且可以正常工作,但是我正在设置迄今为止似乎有效的聚合,但无论出于何种原因,我都无法在我正在聚合的字段上进行搜索。这是我的模型的摘录:

    settings :index => { :number_of_shards => 1 } do
        mapping do
          indexes :id, index: :not_analyzed
          indexes :name
          indexes :summary
          indexes :description

          indexes :occasions, type: 'nested' do
            indexes :id, type: 'integer'
            indexes :occasion_name, type: 'string', index: :not_analyzed

           ... 

          end
        end
      end




  def as_indexed_json(options = {})
    self.as_json(only: [:id, :name, :summary, :description],
                 include: {
                     occasions:           { only: [:id, :occasion_name] },
                     courses:             { only: [:id, :course_name] },
                     allergens:           { only: [:id, :allergen_name] },
                     cookingtechniques:   { only: [:id, :name] …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails elasticsearch

3
推荐指数
1
解决办法
4323
查看次数

尝试是否适用于没有字母的语言?

我正在尝试找出实现类似效率的最有效方法,就好像使用Trie存储英语单词一样,但我希望将单词存储在没有字母的语言中,例如中文.例如,我希望能够加载单词列表并拥有一个应用程序,当用户键入时,该应用程序会根据已输入的字符实时提供建议.任何建议如何实现这一点就像我使用Tries一样,我将拥有大量的父节点,因为有数千个独特的字符.有没有确定的方法来实现我上面描述的内容?

java algorithm data-structures

1
推荐指数
1
解决办法
99
查看次数