• elastic search 概念


    1. index 与 type

    index 相当于 mysql 的 database, type 相当于 table

    2. mapping

    mapping 相当于 mysql table 的列属性声明。

    ES 支持非常灵活的数据格式,即便某个属性并没有在mapping中声明,以后也能直接添加到 ES 中存储,这是优于传统DB的一个很大的方面。

    如果在创建 type 时不指定 mapping,那么 ES 会根据输入的 doc 判断各个域的类型,自动生成 mapping,比如

    {
        "name": {
            "first": "John"
        }
    }

    Mapping: [可以通过localhost:9200/indexName/typeName/_mapping 查看]

    {
      "my_type" : {
        "properties" : {
          "name" : {
            "properties" : {
              "first" : {
                "type" : "string"
              }
            }
          }
        }
      }
    }

    但是,自动生成的mapping有几个缺点

    1. 自动推导的类型和期待的不一样,比如 ES 会把 timestamp 推导成 Long,这样我们就没法使用 ES 按照时间聚集的功能了

    2. ES 支持分词,自动生成的 mapping 只能使用默认的 analyzer

    3. 造成冗余数据[不懂]

  • 相关阅读:
    android:ViewPager实现Tabs滑动切换效果
    android:实现退出确认对话框
    jsp初探
    struts2获取前台数据的三种方式
    struts表单验证
    SingleTon
    读取文件中内容并统计排序
    android:TabHost总结
    java i/o
    tomcat7.0连接池配置
  • 原文地址:https://www.cnblogs.com/xinsheng/p/4417293.html
Copyright © 2020-2023  润新知