有人能告诉我ElasticSearch上是否有相同的Solr copyField指令?
我知道有多字段类型:http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html当你想在同一个字段上应用多个分析器时,这很好 .
但它并不完全相同 . Solr允许将多个字段“合并”为一个:
<field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="string" indexed="true" stored="true"/>
<field name="subject" type="string" indexed="true" stored="true"/>
<field name="location" type="string" indexed="true" stored="true"/>
<field name="all" type="text" indexed="true" stored="true" multiValued="true"/>
<copyField source="*" dest="all"/>
这个插件很有前途:https://github.com/yakaz/elasticsearch-analysis-combo
因为它允许在使用ElasticSearch多值字段时将结果作为单个字段返回 . 但它仍然不完全相同,因为它不允许“合并”多个字段 .
我想要Combo分析器和Solr copyField的组合 .
我有一个博客文章模型( Headers /描述字段),并希望在单个字段“blogContent”上复制 Headers 和描述,我将在其中应用2个不同的分析器 .
ElasticSearch有解决方案吗?
2 回答
默认情况下,special _all field会获取所有其他字段的副本 . 您可以使用
include_in_all
属性控制包含到_all
字段中 . 但是,您只能使用这样的一个字段 . 如果您需要多个,则需要通过搜索多个字段在搜索端处理它 .通过将
multi_field
与"path": "just_name"
属性一起使用,也可以实现类似于copyField的功能:弹性搜索支持copyTo:
旧链接(死):http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#copy-to
当前链接参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/copy-to.html
指南中的当前链接:https://www.elastic.co/guide/en/elasticsearch/guide/current/custom-all.html
您可以在要复制到的字段上添加分析器 .