Elasticsearch中的“映射”有什么作用?

问题描述 投票:0回答:2

我刚开始学习Elasticsearch。我正在尝试创建索引,添加数据,删除数据和搜索数据。我也可以理解Elasticsearch的设置。

使用“PUT”使用设置时

{
"settings": {
"index.number_of_shards" : 1,
"index.number_of_replicas" : 0
 }
}

使用“GET”检索设置信息时

{
"dsm" : {
"settings" : {
  "index" : {
    "creation_date" : "1555487684262",
    "number_of_shards" : "1",
    "number_of_replicas" : "0",
    "uuid" : "qsSr69OdTuugP2DUwrMh4g",
    "version" : {
      "created" : "7000099"
    },
    "provided_name" : "dsm"
  }
}
}
}

然而,

Elasticsearch中的“映射”有什么作用?

{
  "kibana_sample_data_flights" : {
"aliases" : { },
"mappings" : {
  "properties" : {
    "AvgTicketPrice" : {
      "type" : "float"
    },
    "Cancelled" : {
      "type" : "boolean"
    },
    "Carrier" : {
      "type" : "keyword"
    },
    "Dest" : {
      "type" : "keyword"
    },
    "DestAirportID" : {
      "type" : "keyword"
    },
    "DestCityName" : {

    },  // just part of data
elasticsearch elasticsearch-5
2个回答
3
投票

映射文档是一种描述数据结构和定义类型的方法,例如布尔值,文本,关键字。这些类型非常重要,因为它们决定了字段的索引和分析方式。

Elasticsearch支持动态映射,因此可以有效地执行适当类型的自动最佳猜测,但您可能希望覆盖这些。

我发现这是一篇有用的文章来解释映射过程:https://www.elastic.co/blog/found-elasticsearch-mapping-introduction

索引由字段类型确定,例如,类型为“关键字”,搜索引擎将期望完全匹配,当类型为“文本”时,搜索引擎将尝试确定文档与查询字词的匹配程度和这样做将执行“全文搜索”。

例如: - 搜索跳跃也应该匹配跳跃,跳跃,跳跃甚至跳跃。

这是一篇很好的文章,描述了精确与全文搜索,并且是我采用跳转示例的地方:https://www.elastic.co/guide/en/elasticsearch/guide/current/_exact_values_versus_full_text.html

弹性搜索的大部分功能在于映射和分析。


1
投票

它是索引的映射。这意味着它描述了存储在此索引中的数据。深入了解here

© www.soinside.com 2019 - 2024. All rights reserved.