栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

轮胎术语过滤器不起作用

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

轮胎术语过滤器不起作用

您的问题很可能是由于对该

status
字段使用默认映射而引起的,该映射会将其标记化-小写,拆分为单词等。

比较这两个:

http://localhost:9200/myindex/_analyze?text=Text1&analyzer=standardhttp://localhost:9200/myindex/_analyze?text=Text1&analyzer=keyword

您的解决方案是在映射中使用

keyword
分析器(或将字段设置为
not_analyzed
)。如果该字段不是“枚举”类型的数据,则可以使用多字段功能。

有效的Ruby版本如下所示:

require 'tire'Tire.index('myindex') do  delete  create mappings: {    document: {      properties: {        status: { type: 'string', analyzer: 'keyword' }      }    }  }  store status: 'Test1'  store status: 'Test2'  refreshendsearch = Tire.search 'myindex' do  query do    filtered do      query { all }      filter :terms, status: ['Test1']    end  endendputs search.results.to_a.inspect

注意:在没有提供索引映射,示例数据等的情况下,极不可能(在这种情况下为例外)提供合理的建议。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/409532.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号