【问题标题】:Create multi field in elastic search在弹性搜索中创建多字段
【发布时间】:2016-02-08 01:28:40
【问题描述】:

我想创建一个索引,这是我的映射。我想在字段上创建一个多字段 - 'findings' 一个使用默认映射(analzyed),另一个使用'orig'(not_analyzed)。

PUT nto
{
   "mappings": {
      "_default_": {
         "properties": {
            "date": {
               "type": "string",
               "index": "not_analyzed"
            },
            "bo": {
               "type": "string",
               "index": "not_analyzed"
            },
            "pg": {
               "type": "string"
            },
            "rate": {
               "type": "float"
            },
            "findings": {
               "type": "multi_field",
               "fields": {
                  "findings": {
                     "type": "string",
                     "index": "analyzed"
                  },
                  "orig": {
                     "type": "string",
                     "index":"not_analyzed"
                  }
               }
            }
         }
      }
   }
}

创建映射后,我看不到正在创建的 orig 字段。这是我看到的映射,

{
   "ccdn": {
      "aliases": {},
      "mappings": {
         "test": {
            "properties": {
               "bo": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "date": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "findings": {
                  "type": "string",
                  "fields": {
                     "orig": {
                        "type": "string",
                        "index": "not_analyzed"
                     }
                  }
               },
               "pg": {
                  "type": "string"
               },
               "rate": {
                  "type": "float"
               }
            }
         },
         "_default_": {
            "properties": {
               "bo": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "date": {
                  "type": "string",
                  "index": "not_analyzed"
               },
               "findings": {
                  "type": "string",
                  "fields": {
                     "orig": {
                        "type": "string",
                        "index": "not_analyzed"
                     }
                  }
               },
               "pg": {
                  "type": "string"
               },
               "rate": {
                  "type": "float"
               }
            }
         }
      },
      "settings": {
         "index": {
            "creation_date": "1454893575663",
            "uuid": "wJndGz1aSVSFjtidywsRPg",
            "number_of_replicas": "1",
            "number_of_shards": "5",
            "version": {
               "created": "2020099"
            }
         }
      },
      "warmers": {}
   }
}

我没有看到正在创建的默认字段“发现” - 已分析。

【问题讨论】:

  • 您使用的是哪个版本的 Elastic 搜索?
  • 我使用的是最新版本 - 2.2

标签: elasticsearch


【解决方案1】:

Elasticsearch 多字段已过期。见here。 您的 findings 字段可能需要这样的内容:

"findings": {
    "type": "string",
    "index": "analyzed",
    "fields": {
        "orig":   { "type": "string", "index": "not_analyzed" }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多