mirror of https://github.com/dunwu/db-tutorial.git
252 lines
74 KiB
HTML
252 lines
74 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en-US">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
<title>Elasticsearch 索引 | DB-TUTORIAL</title>
|
||
<meta name="generator" content="VuePress 1.9.9">
|
||
<link rel="icon" href="/db-tutorial/img/favicon.ico">
|
||
<script src="https://cdn.wwads.cn/js/makemoney.js" type="text/javascript"></script>
|
||
<meta name="description" content="☕ db-tutorial 是一个数据库教程。">
|
||
<meta name="keywords" content="vuepress,theme,blog,vdoing">
|
||
<meta name="theme-color" content="#11a8cd">
|
||
<meta name="wwads-cn-verify" content="mxqWx62nfQQ9ocT4e5DzISHzOWyF4s">
|
||
|
||
<link rel="preload" href="/db-tutorial/assets/css/0.styles.51390d19.css" as="style"><link rel="preload" href="/db-tutorial/assets/js/app.be3f2e92.js" as="script"><link rel="preload" href="/db-tutorial/assets/js/2.aded268b.js" as="script"><link rel="preload" href="/db-tutorial/assets/js/70.40a2cea2.js" as="script"><link rel="prefetch" href="/db-tutorial/assets/js/10.551ab278.js"><link rel="prefetch" href="/db-tutorial/assets/js/11.c049b6a2.js"><link rel="prefetch" href="/db-tutorial/assets/js/12.92d587d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/13.a7b35fa5.js"><link rel="prefetch" href="/db-tutorial/assets/js/14.9ec959b5.js"><link rel="prefetch" href="/db-tutorial/assets/js/15.e7943372.js"><link rel="prefetch" href="/db-tutorial/assets/js/16.c6ad7b26.js"><link rel="prefetch" href="/db-tutorial/assets/js/17.39500ebd.js"><link rel="prefetch" href="/db-tutorial/assets/js/18.29949979.js"><link rel="prefetch" href="/db-tutorial/assets/js/19.78f879b8.js"><link rel="prefetch" href="/db-tutorial/assets/js/20.3ce14df7.js"><link rel="prefetch" href="/db-tutorial/assets/js/21.9d311c7c.js"><link rel="prefetch" href="/db-tutorial/assets/js/22.90234550.js"><link rel="prefetch" href="/db-tutorial/assets/js/23.12cf9e2d.js"><link rel="prefetch" href="/db-tutorial/assets/js/24.5b436e46.js"><link rel="prefetch" href="/db-tutorial/assets/js/25.8f2dc7d9.js"><link rel="prefetch" href="/db-tutorial/assets/js/26.61665ff4.js"><link rel="prefetch" href="/db-tutorial/assets/js/27.dfc7cc88.js"><link rel="prefetch" href="/db-tutorial/assets/js/28.a6286a66.js"><link rel="prefetch" href="/db-tutorial/assets/js/29.bfa8c106.js"><link rel="prefetch" href="/db-tutorial/assets/js/3.82108019.js"><link rel="prefetch" href="/db-tutorial/assets/js/30.c93b7a2e.js"><link rel="prefetch" href="/db-tutorial/assets/js/31.d48aab81.js"><link rel="prefetch" href="/db-tutorial/assets/js/32.33f8bb7c.js"><link rel="prefetch" href="/db-tutorial/assets/js/33.eb3b622d.js"><link rel="prefetch" href="/db-tutorial/assets/js/34.1ba1a06c.js"><link rel="prefetch" href="/db-tutorial/assets/js/35.24e4fee8.js"><link rel="prefetch" href="/db-tutorial/assets/js/36.dc61504e.js"><link rel="prefetch" href="/db-tutorial/assets/js/37.f1c9c729.js"><link rel="prefetch" href="/db-tutorial/assets/js/38.5024023f.js"><link rel="prefetch" href="/db-tutorial/assets/js/39.30ed016e.js"><link rel="prefetch" href="/db-tutorial/assets/js/4.884deeca.js"><link rel="prefetch" href="/db-tutorial/assets/js/40.6a6327f0.js"><link rel="prefetch" href="/db-tutorial/assets/js/41.3767f4d8.js"><link rel="prefetch" href="/db-tutorial/assets/js/42.14a20b0f.js"><link rel="prefetch" href="/db-tutorial/assets/js/43.b059081c.js"><link rel="prefetch" href="/db-tutorial/assets/js/44.73f724d9.js"><link rel="prefetch" href="/db-tutorial/assets/js/45.68f2ab27.js"><link rel="prefetch" href="/db-tutorial/assets/js/46.aed8a61f.js"><link rel="prefetch" href="/db-tutorial/assets/js/47.3bbf2366.js"><link rel="prefetch" href="/db-tutorial/assets/js/48.81688356.js"><link rel="prefetch" href="/db-tutorial/assets/js/49.1d366c93.js"><link rel="prefetch" href="/db-tutorial/assets/js/5.42f2cdb7.js"><link rel="prefetch" href="/db-tutorial/assets/js/50.ee6f08b7.js"><link rel="prefetch" href="/db-tutorial/assets/js/51.47835d9d.js"><link rel="prefetch" href="/db-tutorial/assets/js/52.b0cab79c.js"><link rel="prefetch" href="/db-tutorial/assets/js/53.106440a2.js"><link rel="prefetch" href="/db-tutorial/assets/js/54.340ab690.js"><link rel="prefetch" href="/db-tutorial/assets/js/55.00623de9.js"><link rel="prefetch" href="/db-tutorial/assets/js/56.9f086601.js"><link rel="prefetch" href="/db-tutorial/assets/js/57.f5ad5f3f.js"><link rel="prefetch" href="/db-tutorial/assets/js/58.14827368.js"><link rel="prefetch" href="/db-tutorial/assets/js/59.c41f57d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/6.5a5b4e54.js"><link rel="prefetch" href="/db-tutorial/assets/js/60.314534c0.js"><link rel="prefetch" href="/db-tutorial/assets/js/61.1ea5e4b7.js"><link rel="prefetch" href="/db-tutorial/assets/js/62.8b52e8fc.js"><link rel="prefetch" href="/db-tutorial/assets/js/63.d2fa8325.js"><link rel="prefetch" href="/db-tutorial/assets/js/64.ea2577e7.js"><link rel="prefetch" href="/db-tutorial/assets/js/65.563da2bb.js"><link rel="prefetch" href="/db-tutorial/assets/js/66.34eb51bd.js"><link rel="prefetch" href="/db-tutorial/assets/js/67.ab57f04f.js"><link rel="prefetch" href="/db-tutorial/assets/js/68.15b6f540.js"><link rel="prefetch" href="/db-tutorial/assets/js/69.54590de4.js"><link rel="prefetch" href="/db-tutorial/assets/js/7.913bec54.js"><link rel="prefetch" href="/db-tutorial/assets/js/71.3ce50922.js"><link rel="prefetch" href="/db-tutorial/assets/js/72.b9c022e9.js"><link rel="prefetch" href="/db-tutorial/assets/js/73.fba94661.js"><link rel="prefetch" href="/db-tutorial/assets/js/74.998d6c2f.js"><link rel="prefetch" href="/db-tutorial/assets/js/75.6efb68b0.js"><link rel="prefetch" href="/db-tutorial/assets/js/76.57273256.js"><link rel="prefetch" href="/db-tutorial/assets/js/77.3ddffb5b.js"><link rel="prefetch" href="/db-tutorial/assets/js/78.8fde3d74.js"><link rel="prefetch" href="/db-tutorial/assets/js/79.7a472c31.js"><link rel="prefetch" href="/db-tutorial/assets/js/8.103b4774.js"><link rel="prefetch" href="/db-tutorial/assets/js/80.4c55c65f.js"><link rel="prefetch" href="/db-tutorial/assets/js/81.cbdb67b8.js"><link rel="prefetch" href="/db-tutorial/assets/js/82.9c14d852.js"><link rel="prefetch" href="/db-tutorial/assets/js/83.a3d7d272.js"><link rel="prefetch" href="/db-tutorial/assets/js/84.6994dacc.js"><link rel="prefetch" href="/db-tutorial/assets/js/85.aca8d788.js"><link rel="prefetch" href="/db-tutorial/assets/js/86.00671865.js"><link rel="prefetch" href="/db-tutorial/assets/js/87.9076c4e8.js"><link rel="prefetch" href="/db-tutorial/assets/js/88.bbe68dab.js"><link rel="prefetch" href="/db-tutorial/assets/js/89.e2173071.js"><link rel="prefetch" href="/db-tutorial/assets/js/9.386bfe3a.js"><link rel="prefetch" href="/db-tutorial/assets/js/90.429162f2.js"><link rel="prefetch" href="/db-tutorial/assets/js/91.6ecc7c85.js"><link rel="prefetch" href="/db-tutorial/assets/js/92.efe42934.js"><link rel="prefetch" href="/db-tutorial/assets/js/93.69562766.js"><link rel="prefetch" href="/db-tutorial/assets/js/94.04aebfbc.js"><link rel="prefetch" href="/db-tutorial/assets/js/95.fe7cfce4.js"><link rel="prefetch" href="/db-tutorial/assets/js/96.674475d6.js"><link rel="prefetch" href="/db-tutorial/assets/js/97.8a7b73f2.js"><link rel="prefetch" href="/db-tutorial/assets/js/98.bf85add1.js">
|
||
<link rel="stylesheet" href="/db-tutorial/assets/css/0.styles.51390d19.css">
|
||
</head>
|
||
<body class="theme-mode-light">
|
||
<div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/db-tutorial/" class="home-link router-link-active"><img src="https://raw.githubusercontent.com/dunwu/images/master/common/dunwu-logo.png" alt="DB-TUTORIAL" class="logo"> <span class="site-name can-hide">DB-TUTORIAL</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/db-tutorial/12.数据库/01.数据库综合/" class="nav-link">数据库综合</a></div><div class="nav-item"><a href="/db-tutorial/12.数据库/02.数据库中间件/" class="nav-link">数据库中间件</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="关系型数据库" class="dropdown-title"><a href="/db-tutorial/12.数据库/03.关系型数据库/" class="link-title">关系型数据库</a> <span class="title" style="display:none;">关系型数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/01.综合/" class="nav-link">综合</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/02.Mysql/" class="nav-link">Mysql</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/99.其他/" class="nav-link">其他</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="文档数据库" class="dropdown-title"><!----> <span class="title" style="display:;">文档数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/04.文档数据库/01.MongoDB/" class="nav-link">MongoDB</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="KV数据库" class="dropdown-title"><!----> <span class="title" style="display:;">KV数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/05.KV数据库/01.Redis/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="搜索引擎数据库" class="dropdown-title"><!----> <span class="title" style="display:;">搜索引擎数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/01.Elasticsearch/" class="nav-link">Elasticsearch</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/02.Elastic/" class="nav-link">Elastic技术栈</a></li></ul></div></div> <a href="https://github.com/dunwu/db-tutorial" target="_blank" rel="noopener noreferrer" class="repo-link">
|
||
GitHub
|
||
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/db-tutorial/12.数据库/01.数据库综合/" class="nav-link">数据库综合</a></div><div class="nav-item"><a href="/db-tutorial/12.数据库/02.数据库中间件/" class="nav-link">数据库中间件</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="关系型数据库" class="dropdown-title"><a href="/db-tutorial/12.数据库/03.关系型数据库/" class="link-title">关系型数据库</a> <span class="title" style="display:none;">关系型数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/01.综合/" class="nav-link">综合</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/02.Mysql/" class="nav-link">Mysql</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/03.关系型数据库/99.其他/" class="nav-link">其他</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="文档数据库" class="dropdown-title"><!----> <span class="title" style="display:;">文档数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/04.文档数据库/01.MongoDB/" class="nav-link">MongoDB</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="KV数据库" class="dropdown-title"><!----> <span class="title" style="display:;">KV数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/05.KV数据库/01.Redis/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="搜索引擎数据库" class="dropdown-title"><!----> <span class="title" style="display:;">搜索引擎数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/01.Elasticsearch/" class="nav-link">Elasticsearch</a></li><li class="dropdown-item"><!----> <a href="/db-tutorial/12.数据库/07.搜索引擎数据库/02.Elastic/" class="nav-link">Elastic技术栈</a></li></ul></div></div> <a href="https://github.com/dunwu/db-tutorial" target="_blank" rel="noopener noreferrer" class="repo-link">
|
||
GitHub
|
||
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库综合</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>数据库中间件</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>关系型数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>文档数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>KV数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>列式数据库</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>搜索引擎数据库</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><section class="sidebar-group collapsable is-sub-group depth-1"><p class="sidebar-heading open"><span>Elasticsearch</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/db-tutorial/pages/0cb563/" class="sidebar-link">Elasticsearch 面试总结</a></li><li><a href="/db-tutorial/pages/98c3a5/" class="sidebar-link">Elasticsearch 快速入门</a></li><li><a href="/db-tutorial/pages/0fb506/" class="sidebar-link">Elasticsearch 简介</a></li><li><a href="/db-tutorial/pages/293175/" aria-current="page" class="active sidebar-link">Elasticsearch 索引</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/293175/#索引管理操作" class="sidebar-link">索引管理操作</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#索引删除" class="sidebar-link">索引删除</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#索引别名" class="sidebar-link">索引别名</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/293175/#settings-详解" class="sidebar-link">Settings 详解</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#固定属性" class="sidebar-link">固定属性</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#索引静态配置" class="sidebar-link">索引静态配置</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#索引动态配置" class="sidebar-link">索引动态配置</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/293175/#mapping-详解" class="sidebar-link">Mapping 详解</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#映射分类" class="sidebar-link">映射分类</a></li><li class="sidebar-sub-header level4"><a href="/db-tutorial/pages/293175/#静态映射" class="sidebar-link">静态映射</a></li><li class="sidebar-sub-header level4"><a href="/db-tutorial/pages/293175/#动态映射" class="sidebar-link">动态映射</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#基础类型" class="sidebar-link">基础类型</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#复杂类型" class="sidebar-link">复杂类型</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#特殊类型" class="sidebar-link">特殊类型</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#mapping-属性" class="sidebar-link">Mapping 属性</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/293175/#索引查询" class="sidebar-link">索引查询</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#多个-index、多个-type-查询" class="sidebar-link">多个 index、多个 type 查询</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#uri-搜索" class="sidebar-link">URI 搜索</a></li><li class="sidebar-sub-header level3"><a href="/db-tutorial/pages/293175/#查询流程" class="sidebar-link">查询流程</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/db-tutorial/pages/293175/#参考资料" class="sidebar-link">参考资料</a></li></ul></li><li><a href="/db-tutorial/pages/83bd15/" class="sidebar-link">Elasticsearch 查询</a></li><li><a href="/db-tutorial/pages/e1b769/" class="sidebar-link">Elasticsearch 高亮搜索及显示</a></li><li><a href="/db-tutorial/pages/24baff/" class="sidebar-link">Elasticsearch 排序</a></li><li><a href="/db-tutorial/pages/f89f66/" class="sidebar-link">Elasticsearch 聚合</a></li><li><a href="/db-tutorial/pages/a5a001/" class="sidebar-link">Elasticsearch 分析器</a></li><li><a href="/db-tutorial/pages/2d95ce/" class="sidebar-link">Elasticsearch 性能优化</a></li><li><a href="/db-tutorial/pages/4b1907/" class="sidebar-link">Elasticsearch Rest API</a></li><li><a href="/db-tutorial/pages/201e43/" class="sidebar-link">ElasticSearch Java API 之 High Level REST Client</a></li><li><a href="/db-tutorial/pages/9a2546/" class="sidebar-link">Elasticsearch 集群和分片</a></li><li><a href="/db-tutorial/pages/fdaf15/" class="sidebar-link">Elasticsearch 运维</a></li></ul></section></li><li><section class="sidebar-group collapsable is-sub-group depth-1"><p class="sidebar-heading"><span>Elastic</span> <span class="arrow right"></span></p> <!----></section></li></ul></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/db-tutorial/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><a href="/db-tutorial/categories/?category=%E6%95%B0%E6%8D%AE%E5%BA%93" title="分类" data-v-06225672>数据库</a></li><li data-v-06225672><a href="/db-tutorial/categories/?category=%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E%E6%95%B0%E6%8D%AE%E5%BA%93" title="分类" data-v-06225672>搜索引擎数据库</a></li><li data-v-06225672><a href="/db-tutorial/categories/?category=Elasticsearch" title="分类" data-v-06225672>Elasticsearch</a></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="https://github.com/dunwu" target="_blank" title="作者" class="beLink" data-v-06225672>dunwu</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2022-02-22</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAABKFJREFUSA3tVl1oFVcQnrMbrak3QUgkya1akpJYcrUtIqW1JvFBE9LiQ5v6JmJpolbMg32rVrhgoYK0QiMY6i9Y6EMaW5D+xFJaTYItIuK2Kr3+BJNwkxBj05sQY3b3nM6cs2dv9t7NT/vQJw/sndk5M/PNzJkzewGerP+pAmy+ON8lLzUJgA8ZYxYIYZmGYRnctDaWvJJAmTtfP1pvXsBCCPP8QFcCaRkZYACgDZFO4stNIcBCajEOlmmC9XpJ9bAGCaPaPmzPl32dvLSVu3BWCTQs0XQQ6g0DYgwLIoAZbBCdW/i+781o1VVlm/410mw4h06Y7bIPHNyWDyL4FHkX03Q8SrzNhZTZriieckWt7cL6MM85YcLpsi/7O9/iXFT6MswI0DmmpkSaJ0qLxFIm3+i1THHB3zmBH3PYx9CcykcLOeQVVa7QtdxTgQgEleX2AjHYfwA+2ddV77ruGoJUbhGDI09YSNXyMpUt5ylOzxgbUmtOp7NmbNt8v3arjTBfYELmLUV+M+nSawNNAUqpT3ClJWg5I3BLT+cGW/DXNGCa6tx1aakCGEigArTn4TDIPdrXXYKCZNrHLMCOEPvHBlLQ99s9eHB7EB6NTki73CVPQ2F5MSx/uRQixfmq7rK0wYD8w8E905bnPDfwoWs/rfv93NWN/ZfvwsLIU7A09gxECyISeGJkHAau98L97tuw7NXnoPyNF8FcYGLGKsOs0mN3OEyec9esGW/ZEl945dTP34wlR2FZVQWU1q0Cw8Tr7p+hgLLNL0FPxx/Q35mA8aEUrH6nCgwEl0tn7wUiZYJnNRh6DK4UH/k0lfyrsBKdPVv/AriGIQcEDQZ65LBAGe2Rzui9Ybjz7XUppz1/uKBbyVPGkN3ZAeC6hr0x7Nr38N5+EqkoOm17xpoqR9ohQF55ERSvr4Dkr3chNfC3DMzGJlNBElW8w9nsGQvhNGIzDkXzCg8cLK951xHsFBlTJspJNi3ZFIMF2AeDV3q8DNOB+YHi6QTrChDIWDBRi5U5f+ZMfJLu3ccrqxtdxk4SKH336LFxSmkqefwU5T8fhdSdQf9IVKD6aNiwI/hnmcAZ91isYMJIaCUCx9W098+LgruikeTqzqqxKPUwqJyCPJiyemVVZBOijDGjD38Os0jOiSPL1z3SPjXNANbiNPXAdzTfukjjuknNBbyz3nwgTd3AVFqUJ5hpHlq9MveLnWwttUfoygBmvVjuikxND3znrhsELnZk7k+OjIGxeNEkomyLVta0xxn+HZhjBc4YZ/AFjHjz9u3xRZl2BN4aq9nFwWh16IrQ1aHHEd3j1+4/dB9OtH4e29A2H1DyHQRmOSfQZ1Fy7MHBTGB6J/Djq6p3OxyO2cB+4Car7v/o3GXgfAkj23+x9ID1Teoamo/SXcbvSf2PX7Vc8DdCmE1vN9di+32P9/5YR3vLnhCVGUWBjEkr3yh4H8v9CzmsbdhzOKzsJKM90iFdaTMjRPhGVsakRvOaRidljo6H6G7j+ctrJpsP+4COhDIl0La2+FS4+5mlocBaXY5QnGZysIBYoeSsl5qQzrSj/cgNrfuEzlWBfwA+EjrZyWUvpAAAAABJRU5ErkJggg==">Elasticsearch 索引<!----></h1> <div class="theme-vdoing-content content__default"><h1 id="elasticsearch-索引"><a href="#elasticsearch-索引" class="header-anchor">#</a> Elasticsearch 索引</h1> <h2 id="索引管理操作"><a href="#索引管理操作" class="header-anchor">#</a> 索引管理操作</h2> <p>Elasticsearch 索引管理主要包括如何进行索引的创建、索引的删除、副本的更新、索引读写权限、索引别名的配置等等内容。</p> <h3 id="索引删除"><a href="#索引删除" class="header-anchor">#</a> 索引删除</h3> <p>ES 索引删除操作向 ES 集群的 http 接口发送指定索引的 delete http 请求即可,可以通过 curl 命令,具体如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">curl</span> <span class="token parameter variable">-X</span> DELETE http://<span class="token punctuation">{</span>es_host<span class="token punctuation">}</span>:<span class="token punctuation">{</span>es_http_port<span class="token punctuation">}</span>/<span class="token punctuation">{</span>index<span class="token punctuation">}</span>
|
||
</code></pre></div><p>如果删除成功,它会返回如下信息,具体示例如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">curl</span> <span class="token parameter variable">-X</span> DELETE http://10.10.10.66:9200/my_index?pretty
|
||
</code></pre></div><p>为了返回的信息便于读取,增加了 pretty 参数:</p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token punctuation">{</span>
|
||
<span class="token string">"acknowledged"</span> <span class="token builtin class-name">:</span> <span class="token boolean">true</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><h3 id="索引别名"><a href="#索引别名" class="header-anchor">#</a> 索引别名</h3> <p>ES 的索引别名就是给一个索引或者多个索引起的另一个名字,典型的应用场景是针对索引使用的平滑切换。</p> <p>首先,创建索引 my_index,然后将别名 my_alias 指向它,示例如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>PUT /my_index
|
||
PUT /my_index/_alias/my_alias
|
||
</code></pre></div><p>也可以通过如下形式:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>POST /_aliases
|
||
<span class="token punctuation">{</span>
|
||
<span class="token string">"actions"</span><span class="token builtin class-name">:</span> <span class="token punctuation">[</span>
|
||
<span class="token punctuation">{</span> <span class="token string">"add"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span> <span class="token string">"index"</span><span class="token builtin class-name">:</span> <span class="token string">"my_index"</span>, <span class="token string">"alias"</span><span class="token builtin class-name">:</span> <span class="token string">"my_alias"</span> <span class="token punctuation">}</span><span class="token punctuation">}</span>
|
||
<span class="token punctuation">]</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>也可以在一次请求中增加别名和移除别名混合使用:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>POST /_aliases
|
||
<span class="token punctuation">{</span>
|
||
<span class="token string">"actions"</span><span class="token builtin class-name">:</span> <span class="token punctuation">[</span>
|
||
<span class="token punctuation">{</span> <span class="token string">"remove"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span> <span class="token string">"index"</span><span class="token builtin class-name">:</span> <span class="token string">"my_index"</span>, <span class="token string">"alias"</span><span class="token builtin class-name">:</span> <span class="token string">"my_alias"</span> <span class="token punctuation">}</span><span class="token punctuation">}</span>
|
||
<span class="token punctuation">{</span> <span class="token string">"add"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span> <span class="token string">"index"</span><span class="token builtin class-name">:</span> <span class="token string">"my_index_v2"</span>, <span class="token string">"alias"</span><span class="token builtin class-name">:</span> <span class="token string">"my_alias"</span> <span class="token punctuation">}</span><span class="token punctuation">}</span>
|
||
<span class="token punctuation">]</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><blockquote><p>需要注意的是,如果别名与索引是一对一的,使用别名索引文档或者查询文档是可以的,但是如果别名和索引是一对多的,使用别名会发生错误,因为 ES 不知道把文档写入哪个索引中去或者从哪个索引中读取文档。</p></blockquote> <p>ES 索引别名有个典型的应用场景是平滑切换,更多细节可以查看 <a href="https://www.knowledgedict.com/tutorial/elasticsearch-index-smooth-shift.html" target="_blank" rel="noopener noreferrer">Elasticsearch(ES)索引零停机(无需重启)无缝平滑切换的方法<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>。</p> <h2 id="settings-详解"><a href="#settings-详解" class="header-anchor">#</a> Settings 详解</h2> <p>Elasticsearch 索引的配置项主要分为<strong>静态配置属性</strong>和<strong>动态配置属性</strong>,静态配置属性是索引创建后不能修改,而动态配置属性则可以随时修改。</p> <p>ES 索引设置的 api 为 <strong><em><code>_settings</code></em></strong>,完整的示例如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>PUT /my_index
|
||
<span class="token punctuation">{</span>
|
||
<span class="token string">"settings"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"index"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"number_of_shards"</span><span class="token builtin class-name">:</span> <span class="token string">"1"</span>,
|
||
<span class="token string">"number_of_replicas"</span><span class="token builtin class-name">:</span> <span class="token string">"1"</span>,
|
||
<span class="token string">"refresh_interval"</span><span class="token builtin class-name">:</span> <span class="token string">"60s"</span>,
|
||
<span class="token string">"analysis"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"filter"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"tsconvert"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"type"</span><span class="token builtin class-name">:</span> <span class="token string">"stconvert"</span>,
|
||
<span class="token string">"convert_type"</span><span class="token builtin class-name">:</span> <span class="token string">"t2s"</span>,
|
||
<span class="token string">"delimiter"</span><span class="token builtin class-name">:</span> <span class="token string">","</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"synonym"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"type"</span><span class="token builtin class-name">:</span> <span class="token string">"synonym"</span>,
|
||
<span class="token string">"synonyms_path"</span><span class="token builtin class-name">:</span> <span class="token string">"analysis/synonyms.txt"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"analyzer"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"ik_max_word_synonym"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"filter"</span><span class="token builtin class-name">:</span> <span class="token punctuation">[</span>
|
||
<span class="token string">"synonym"</span>,
|
||
<span class="token string">"tsconvert"</span>,
|
||
<span class="token string">"standard"</span>,
|
||
<span class="token string">"lowercase"</span>,
|
||
<span class="token string">"stop"</span>
|
||
<span class="token punctuation">]</span>,
|
||
<span class="token string">"tokenizer"</span><span class="token builtin class-name">:</span> <span class="token string">"ik_max_word"</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"ik_smart_synonym"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"filter"</span><span class="token builtin class-name">:</span> <span class="token punctuation">[</span>
|
||
<span class="token string">"synonym"</span>,
|
||
<span class="token string">"standard"</span>,
|
||
<span class="token string">"lowercase"</span>,
|
||
<span class="token string">"stop"</span>
|
||
<span class="token punctuation">]</span>,
|
||
<span class="token string">"tokenizer"</span><span class="token builtin class-name">:</span> <span class="token string">"ik_smart"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"mapping"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"coerce"</span><span class="token builtin class-name">:</span> <span class="token string">"false"</span>,
|
||
<span class="token string">"ignore_malformed"</span><span class="token builtin class-name">:</span> <span class="token string">"false"</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"indexing"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"slowlog"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"threshold"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"index"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"warn"</span><span class="token builtin class-name">:</span> <span class="token string">"2s"</span>,
|
||
<span class="token string">"info"</span><span class="token builtin class-name">:</span> <span class="token string">"1s"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"provided_name"</span><span class="token builtin class-name">:</span> <span class="token string">"hospital_202101070533"</span>,
|
||
<span class="token string">"query"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"default_field"</span><span class="token builtin class-name">:</span> <span class="token string">"timestamp"</span>,
|
||
<span class="token string">"parse"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"allow_unmapped_fields"</span><span class="token builtin class-name">:</span> <span class="token string">"false"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"requests"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"cache"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"enable"</span><span class="token builtin class-name">:</span> <span class="token string">"true"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"search"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"slowlog"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"threshold"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"fetch"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"warn"</span><span class="token builtin class-name">:</span> <span class="token string">"1s"</span>,
|
||
<span class="token string">"info"</span><span class="token builtin class-name">:</span> <span class="token string">"200ms"</span>
|
||
<span class="token punctuation">}</span>,
|
||
<span class="token string">"query"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"warn"</span><span class="token builtin class-name">:</span> <span class="token string">"1s"</span>,
|
||
<span class="token string">"info"</span><span class="token builtin class-name">:</span> <span class="token string">"500ms"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><h3 id="固定属性"><a href="#固定属性" class="header-anchor">#</a> 固定属性</h3> <ul><li><strong><em><code>index.creation_date</code></em></strong>:顾名思义索引的创建时间戳。</li> <li><strong><em><code>index.uuid</code></em></strong>:索引的 uuid 信息。</li> <li><strong><em><code>index.version.created</code></em></strong>:索引的版本号。</li></ul> <h3 id="索引静态配置"><a href="#索引静态配置" class="header-anchor">#</a> 索引静态配置</h3> <ul><li><strong><em><code>index.number_of_shards</code></em></strong>:索引的主分片数,默认值是 <strong><em><code>5</code></em></strong>。这个配置在索引创建后不能修改;在 es 层面,可以通过 <strong><em><code>es.index.max_number_of_shards</code></em></strong> 属性设置索引最大的分片数,默认为 <strong><em><code>1024</code></em></strong>。</li> <li><strong><em><code>index.codec</code></em></strong>:数据存储的压缩算法,默认值为 <strong><em><code>LZ4</code></em></strong>,可选择值还有 <strong><em><code>best_compression</code></em></strong>,它比 LZ4 可以获得更好的压缩比(即占据较小的磁盘空间,但存储性能比 LZ4 低)。</li> <li><strong><em><code>index.routing_partition_size</code></em></strong>:路由分区数,如果设置了该参数,其路由算法为:<code>( hash(_routing) + hash(_id) % index.routing_parttion_size ) % number_of_shards</code>。如果该值不设置,则路由算法为 <code>hash(_routing) % number_of_shardings</code>,<code>_routing</code> 默认值为 <code>_id</code>。</li></ul> <p>静态配置里,有重要的部分是配置分析器(config analyzers)。</p> <ul><li><p><strong><code>index.analysis</code></strong></p> <p>:分析器最外层的配置项,内部主要分为 char_filter、tokenizer、filter 和 analyzer。</p> <ul><li><strong><em><code>char_filter</code></em></strong>:定义新的字符过滤器件。</li> <li><strong><em><code>tokenizer</code></em></strong>:定义新的分词器。</li> <li><strong><em><code>filter</code></em></strong>:定义新的 token filter,如同义词 filter。</li> <li><strong><em><code>analyzer</code></em></strong>:配置新的分析器,一般是 char_filter、tokenizer 和一些 token filter 的组合。</li></ul></li></ul> <h3 id="索引动态配置"><a href="#索引动态配置" class="header-anchor">#</a> 索引动态配置</h3> <ul><li><strong><em><code>index.number_of_replicas</code></em></strong>:索引主分片的副本数,默认值是 <strong><em><code>1</code></em></strong>,该值必须大于等于 0,这个配置可以随时修改。</li> <li><strong><em><code>index.refresh_interval</code></em></strong>:执行新索引数据的刷新操作频率,该操作使对索引的最新更改对搜索可见,默认为 <strong><em><code>1s</code></em></strong>。也可以设置为 <strong><em><code>-1</code></em></strong> 以禁用刷新。更详细信息参考 <a href="https://www.knowledgedict.com/tutorial/elasticsearch-refresh_interval-settings.html" target="_blank" rel="noopener noreferrer">Elasticsearch 动态修改 refresh_interval 刷新间隔设置<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>。</li></ul> <h2 id="mapping-详解"><a href="#mapping-详解" class="header-anchor">#</a> Mapping 详解</h2> <p>在 Elasticsearch 中,<strong><code>Mapping</code></strong>(映射),用来定义一个文档以及其所包含的字段如何被存储和索引,可以在映射中事先定义字段的数据类型、字段的权重、分词器等属性,就如同在关系型数据库中创建数据表时会设置字段的类型。</p> <p>Mapping 会把 json 文档映射成 Lucene 所需要的扁平格式</p> <p>一个 Mapping 属于一个索引的 Type</p> <ul><li>每个文档都属于一个 Type</li> <li>一个 Type 有一个 Mapping 定义</li> <li>7.0 开始,不需要在 Mapping 定义中指定 type 信息</li></ul> <h3 id="映射分类"><a href="#映射分类" class="header-anchor">#</a> 映射分类</h3> <p>在 Elasticsearch 中,映射可分为静态映射和动态映射。在关系型数据库中写入数据之前首先要建表,在建表语句中声明字段的属性,在 Elasticsearch 中,则不必如此,Elasticsearch 最重要的功能之一就是让你尽可能快地开始探索数据,文档写入 Elasticsearch 中,它会根据字段的类型自动识别,这种机制称为<strong>动态映射</strong>,而<strong>静态映射</strong>则是写入数据之前对字段的属性进行手工设置。</p> <h4 id="静态映射"><a href="#静态映射" class="header-anchor">#</a> 静态映射</h4> <p><strong>静态映射</strong>是在创建索引时手工指定索引映射。静态映射和 SQL 中在建表语句中指定字段属性类似。相比动态映射,通过静态映射可以添加更详细、更精准的配置信息。</p> <p>如何定义一个 Mapping</p> <div class="language-bash extra-class"><pre class="language-bash"><code>PUT /books
|
||
<span class="token punctuation">{</span>
|
||
<span class="token string">"mappings"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span>
|
||
<span class="token string">"type_one"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span> <span class="token punctuation">..</span>. any mappings <span class="token punctuation">..</span>. <span class="token punctuation">}</span>,
|
||
<span class="token string">"type_two"</span><span class="token builtin class-name">:</span> <span class="token punctuation">{</span> <span class="token punctuation">..</span>. any mappings <span class="token punctuation">..</span>. <span class="token punctuation">}</span>,
|
||
<span class="token punctuation">..</span>.
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><h4 id="动态映射"><a href="#动态映射" class="header-anchor">#</a> 动态映射</h4> <p><strong>动态映射</strong>是一种偷懒的方式,可直接创建索引并写入文档,文档中字段的类型是 Elasticsearch <strong>自动识别</strong>的,不需要在创建索引的时候设置字段的类型。在实际项目中,如果遇到的业务在导入数据之前不确定有哪些字段,也不清楚字段的类型是什么,使用动态映射非常合适。当 Elasticsearch 在文档中碰到一个以前没见过的字段时,它会利用动态映射来决定该字段的类型,并自动把该字段添加到映射中,根据字段的取值自动推测字段类型的规则见下表:</p> <table><thead><tr><th style="text-align:left;">JSON 格式的数据</th> <th style="text-align:left;">自动推测的字段类型</th></tr></thead> <tbody><tr><td style="text-align:left;">null</td> <td style="text-align:left;">没有字段被添加</td></tr> <tr><td style="text-align:left;">true or false</td> <td style="text-align:left;">boolean 类型</td></tr> <tr><td style="text-align:left;">浮点类型数字</td> <td style="text-align:left;">float 类型</td></tr> <tr><td style="text-align:left;">数字</td> <td style="text-align:left;">long 类型</td></tr> <tr><td style="text-align:left;">JSON 对象</td> <td style="text-align:left;">object 类型</td></tr> <tr><td style="text-align:left;">数组</td> <td style="text-align:left;">由数组中第一个非空值决定</td></tr> <tr><td style="text-align:left;">string</td> <td style="text-align:left;">有可能是 date 类型(若开启日期检测)、double 或 long 类型、text 类型、keyword 类型</td></tr></tbody></table> <p>下面举一个例子认识动态 mapping,在 Elasticsearch 中创建一个新的索引并查看它的 mapping,命令如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>PUT books
|
||
GET books/_mapping
|
||
</code></pre></div><p>此时 books 索引的 mapping 是空的,返回结果如下:</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">{</span>
|
||
<span class="token property">"books"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"mappings"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>再往 books 索引中写入一条文档,命令如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>PUT books/it/1
|
||
<span class="token punctuation">{</span>
|
||
<span class="token string">"id"</span><span class="token builtin class-name">:</span> <span class="token number">1</span>,
|
||
<span class="token string">"publish_date"</span><span class="token builtin class-name">:</span> <span class="token string">"2019-11-10"</span>,
|
||
<span class="token string">"name"</span><span class="token builtin class-name">:</span> <span class="token string">"master Elasticsearch"</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>文档写入完成之后,再次查看 mapping,返回结果如下:</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">{</span>
|
||
<span class="token property">"books"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"mappings"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"properties"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"id"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"long"</span>
|
||
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
||
<span class="token property">"name"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"text"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"fields"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"keyword"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"keyword"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"ignore_above"</span><span class="token operator">:</span> <span class="token number">256</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
||
<span class="token property">"publish_date"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"type"</span><span class="token operator">:</span> <span class="token string">"date"</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>使用动态 mapping 要结合实际业务需求来综合考虑,如果将 Elasticsearch 当作主要的数据存储使用,并且希望出现未知字段时抛出异常来提醒你注意这一问题,那么开启动态 mapping 并不适用。在 mapping 中可以通过 <code>dynamic</code> 设置来控制是否自动新增字段,接受以下参数:</p> <ul><li><strong><code>true</code></strong>:默认值为 true,自动添加字段。</li> <li><strong><code>false</code></strong>:忽略新的字段。</li> <li><strong><code>strict</code></strong>:严格模式,发现新的字段抛出异常。</li></ul> <h3 id="基础类型"><a href="#基础类型" class="header-anchor">#</a> 基础类型</h3> <table><thead><tr><th style="text-align:left;">类型</th> <th style="text-align:left;">关键字</th></tr></thead> <tbody><tr><td style="text-align:left;">字符串类型</td> <td style="text-align:left;">string、text、keyword</td></tr> <tr><td style="text-align:left;">数字类型</td> <td style="text-align:left;">long、integer、short、byte、double、float、half_float、scaled_float</td></tr> <tr><td style="text-align:left;">日期类型</td> <td style="text-align:left;">date</td></tr> <tr><td style="text-align:left;">布尔类型</td> <td style="text-align:left;">boolean</td></tr> <tr><td style="text-align:left;">二进制类型</td> <td style="text-align:left;">binary</td></tr> <tr><td style="text-align:left;">范围类型</td> <td style="text-align:left;">range</td></tr></tbody></table> <h3 id="复杂类型"><a href="#复杂类型" class="header-anchor">#</a> 复杂类型</h3> <table><thead><tr><th style="text-align:left;">类型</th> <th style="text-align:left;">关键字</th></tr></thead> <tbody><tr><td style="text-align:left;">数组类型</td> <td style="text-align:left;">array</td></tr> <tr><td style="text-align:left;">对象类型</td> <td style="text-align:left;">object</td></tr> <tr><td style="text-align:left;">嵌套类型</td> <td style="text-align:left;">nested</td></tr></tbody></table> <h3 id="特殊类型"><a href="#特殊类型" class="header-anchor">#</a> 特殊类型</h3> <table><thead><tr><th style="text-align:left;">类型</th> <th style="text-align:left;">关键字</th></tr></thead> <tbody><tr><td style="text-align:left;">地理类型</td> <td style="text-align:left;">geo_point</td></tr> <tr><td style="text-align:left;">地理图形类型</td> <td style="text-align:left;">geo_shape</td></tr> <tr><td style="text-align:left;">IP 类型</td> <td style="text-align:left;">ip</td></tr> <tr><td style="text-align:left;">范围类型</td> <td style="text-align:left;">completion</td></tr> <tr><td style="text-align:left;">令牌计数类型</td> <td style="text-align:left;">token_count</td></tr> <tr><td style="text-align:left;">附件类型</td> <td style="text-align:left;">attachment</td></tr> <tr><td style="text-align:left;">抽取类型</td> <td style="text-align:left;">percolator</td></tr></tbody></table> <h3 id="mapping-属性"><a href="#mapping-属性" class="header-anchor">#</a> Mapping 属性</h3> <p>Elasticsearch 的 mapping 中的字段属性非常多,具体如下表格:</p> <p>| 属性名 | 描述 |
|
||
| :- | :- | |
|
||
| <strong><em><code>type</code></em></strong> | 字段类型,常用的有 text、integer 等等。 |
|
||
| <strong><em><code>index</code></em></strong> | 当前字段是否被作为索引。可选值为 <strong><em><code>true</code></em></strong>,默认为 true。 |
|
||
| <strong><em><code>store</code></em></strong> | 是否存储指定字段,可选值为 <strong><em><code>true</code></em></strong> | <strong><em><code>false</code></em></strong>,设置 true 意味着需要开辟单独的存储空间为这个字段做存储,而且这个存储是独立于 <strong><em><code>_source</code></em></strong> 的存储的。 |
|
||
| <strong><em><code>norms</code></em></strong> | 是否使用归一化因子,可选值为 <strong><em><code>true</code></em></strong> | <strong><em><code>false</code></em></strong>,不需要对某字段进行打分排序时,可禁用它,节省空间;<em>type</em> 为 <em>text</em> 时,默认为 <em>true</em>;而 <em>type</em> 为 <em>keyword</em> 时,默认为 <em>false</em>。 |
|
||
| <strong><em><code>index_options</code></em></strong> | 索引选项控制添加到倒排索引(Inverted Index)的信息,这些信息用于搜索(Search)和高亮显示:<strong><em><code>docs</code></em></strong>:只索引文档编号(Doc Number);<strong><em><code>freqs</code></em></strong>:索引文档编号和词频率(term frequency);<strong><em><code>positions</code></em></strong>:索引文档编号,词频率和词位置(序号);<strong><em><code>offsets</code></em></strong>:索引文档编号,词频率,词偏移量(开始和结束位置)和词位置(序号)。默认情况下,被分析的字符串(analyzed string)字段使用 <em>positions</em>,其他字段默认使用 <em>docs</em>。此外,需要注意的是 <em>index_option</em> 是 elasticsearch 特有的设置属性;临近搜索和短语查询时,<em>index_option</em> 必须设置为 <em>offsets</em>,同时高亮也可使用 postings highlighter。 |
|
||
| <strong><em><code>term_vector</code></em></strong> | 索引选项控制词向量相关信息:<strong><em><code>no</code></em></strong>:默认值,表示不存储词向量相关信息;<strong><em><code>yes</code></em></strong>:只存储词向量信息;<strong><em><code>with_positions</code></em></strong>:存储词项和词项位置;<strong><em><code>with_offsets</code></em></strong>:存储词项和字符偏移位置;<strong><em><code>with_positions_offsets</code></em></strong>:存储词项、词项位置、字符偏移位置。<em>term_vector</em> 是 lucene 层面的索引设置。 |
|
||
| <strong><em><code>similarity</code></em></strong> | 指定文档相似度算法(也可以叫评分模型):<strong><em><code>BM25</code></em></strong>:ES 5 之后的默认设置。 |
|
||
| <strong><em><code>copy_to</code></em></strong> | 复制到自定义 _all 字段,值是数组形式,即表明可以指定多个自定义的字段。 |
|
||
| <strong><em><code>analyzer</code></em></strong> | 指定索引和搜索时的分析器,如果同时指定 <em>search_analyzer</em> 则搜索时会优先使用 <em>search_analyzer</em>。 |
|
||
| <strong><em><code>search_analyzer</code></em></strong> | 指定搜索时的分析器,搜索时的优先级最高。 |
|
||
| <strong><em><code>null_value</code></em></strong> | 用于需要对 Null 值实现搜索的场景,只有 Keyword 类型支持此配置。 |</p> <h2 id="索引查询"><a href="#索引查询" class="header-anchor">#</a> 索引查询</h2> <h3 id="多个-index、多个-type-查询"><a href="#多个-index、多个-type-查询" class="header-anchor">#</a> 多个 index、多个 type 查询</h3> <p>Elasticsearch 的搜索 api 支持<strong>一个索引(index)的多个类型(type)查询</strong>以及**多个索引(index)**的查询。</p> <p>例如,我们可以搜索 twitter 索引下面所有匹配条件的所有类型中文档,如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>GET /twitter/_search?q<span class="token operator">=</span>user:shay
|
||
</code></pre></div><p>我们也可以搜索一个索引下面指定多个 type 下匹配条件的文档,如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>GET /twitter/tweet,user/_search?q<span class="token operator">=</span>user:banon
|
||
</code></pre></div><p>我们也可以搜索多个索引下匹配条件的文档,如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>GET /twitter,elasticsearch/_search?q<span class="token operator">=</span>tag:wow
|
||
</code></pre></div><p>此外我们也可以搜索所有索引下匹配条件的文档,用_all 表示所有索引,如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>GET /_all/_search?q<span class="token operator">=</span>tag:wow
|
||
</code></pre></div><p>甚至我们可以搜索所有索引及所有 type 下匹配条件的文档,如下:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>GET /_search?q<span class="token operator">=</span>tag:wow
|
||
</code></pre></div><h3 id="uri-搜索"><a href="#uri-搜索" class="header-anchor">#</a> URI 搜索</h3> <p>Elasticsearch 支持用 uri 搜索,可用 get 请求里面拼接相关的参数,并用 curl 相关的命令就可以进行测试。</p> <p>如下有一个示例:</p> <div class="language-bash extra-class"><pre class="language-bash"><code>GET twitter/_search?q<span class="token operator">=</span>user:kimchy
|
||
</code></pre></div><p>如下是上一个请求的相应实体:</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">{</span>
|
||
<span class="token property">"timed_out"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span>
|
||
<span class="token property">"took"</span><span class="token operator">:</span> <span class="token number">62</span><span class="token punctuation">,</span>
|
||
<span class="token property">"_shards"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"total"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
|
||
<span class="token property">"successful"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
|
||
<span class="token property">"skipped"</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
|
||
<span class="token property">"failed"</span><span class="token operator">:</span> <span class="token number">0</span>
|
||
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
||
<span class="token property">"hits"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"total"</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
|
||
<span class="token property">"max_score"</span><span class="token operator">:</span> <span class="token number">1.3862944</span><span class="token punctuation">,</span>
|
||
<span class="token property">"hits"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
|
||
<span class="token punctuation">{</span>
|
||
<span class="token property">"_index"</span><span class="token operator">:</span> <span class="token string">"twitter"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"_type"</span><span class="token operator">:</span> <span class="token string">"_doc"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"_id"</span><span class="token operator">:</span> <span class="token string">"0"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"_score"</span><span class="token operator">:</span> <span class="token number">1.3862944</span><span class="token punctuation">,</span>
|
||
<span class="token property">"_source"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"user"</span><span class="token operator">:</span> <span class="token string">"kimchy"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"date"</span><span class="token operator">:</span> <span class="token string">"2009-11-15T14:12:12"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"message"</span><span class="token operator">:</span> <span class="token string">"trying out Elasticsearch"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"likes"</span><span class="token operator">:</span> <span class="token number">0</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">]</span>
|
||
<span class="token punctuation">}</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre></div><p>URI 中允许的参数:</p> <table><thead><tr><th style="text-align:left;">名称</th> <th style="text-align:left;">描述</th></tr></thead> <tbody><tr><td style="text-align:left;">q</td> <td style="text-align:left;">查询字符串,映射到 query_string 查询</td></tr> <tr><td style="text-align:left;">df</td> <td style="text-align:left;">在查询中未定义字段前缀时使用的默认字段</td></tr> <tr><td style="text-align:left;">analyzer</td> <td style="text-align:left;">查询字符串时指定的分词器</td></tr> <tr><td style="text-align:left;">analyze_wildcard</td> <td style="text-align:left;">是否允许通配符和前缀查询,默认设置为 false</td></tr> <tr><td style="text-align:left;">batched_reduce_size</td> <td style="text-align:left;">应在协调节点上一次减少的分片结果数。如果请求中潜在的分片数量很大,则应将此值用作保护机制,以减少每个搜索请求的内存开销</td></tr> <tr><td style="text-align:left;">default_operator</td> <td style="text-align:left;">默认使用的匹配运算符,可以是<em>AND</em>或者<em>OR</em>,默认是<em>OR</em></td></tr> <tr><td style="text-align:left;">lenient</td> <td style="text-align:left;">如果设置为 true,将会忽略由于格式化引起的问题(如向数据字段提供文本),默认为 false</td></tr> <tr><td style="text-align:left;">explain</td> <td style="text-align:left;">对于每个 hit,包含了具体如何计算得分的解释</td></tr> <tr><td style="text-align:left;">_source</td> <td style="text-align:left;">请求文档内容的参数,默认 true;设置 false 的话,不返回_source 字段,可以使用**_source_include<strong>和</strong>_source_exclude**参数分别指定返回字段和不返回的字段</td></tr> <tr><td style="text-align:left;">stored_fields</td> <td style="text-align:left;">指定每个匹配返回的文档中的存储字段,多个用逗号分隔。不指定任何值将导致没有字段返回</td></tr> <tr><td style="text-align:left;">sort</td> <td style="text-align:left;">排序方式,可以是<em>fieldName</em>、<em>fieldName:asc</em>或者<em>fieldName:desc</em>的形式。fieldName 可以是文档中的实际字段,也可以是诸如_score 字段,其表示基于分数的排序。此外可以指定多个 sort 参数(顺序很重要)</td></tr> <tr><td style="text-align:left;">track_scores</td> <td style="text-align:left;">当排序时,若设置 true,返回每个命中文档的分数</td></tr> <tr><td style="text-align:left;">track_total_hits</td> <td style="text-align:left;">是否返回匹配条件命中的总文档数,默认为 true</td></tr> <tr><td style="text-align:left;">timeout</td> <td style="text-align:left;">设置搜索的超时时间,默认无超时时间</td></tr> <tr><td style="text-align:left;">terminate_after</td> <td style="text-align:left;">在达到查询终止条件之前,指定每个分片收集的最大文档数。如果设置,则在响应中多了一个 terminated_early 的布尔字段,以指示查询执行是否实际上已终止。默认为 no terminate_after</td></tr> <tr><td style="text-align:left;">from</td> <td style="text-align:left;">从第几条(索引以 0 开始)结果开始返回,默认为 0</td></tr> <tr><td style="text-align:left;">size</td> <td style="text-align:left;">返回命中的文档数,默认为 10</td></tr> <tr><td style="text-align:left;">search_type</td> <td style="text-align:left;">搜索的方式,可以是<em>dfs_query_then_fetch</em>或<em>query_then_fetch</em>。默认为<em>query_then_fetch</em></td></tr> <tr><td style="text-align:left;">allow_partial_search_results</td> <td style="text-align:left;">是否可以返回部分结果。如设置为 false,表示如果请求产生部分结果,则设置为返回整体故障;默认为 true,表示允许请求在超时或部分失败的情况下获得部分结果</td></tr></tbody></table> <h3 id="查询流程"><a href="#查询流程" class="header-anchor">#</a> 查询流程</h3> <p>在 Elasticsearch 中,查询是一个比较复杂的执行模式,因为我们不知道那些 document 会被匹配到,任何一个 shard 上都有可能,所以一个 search 请求必须查询一个索引或多个索引里面的所有 shard 才能完整的查询到我们想要的结果。</p> <p>找到所有匹配的结果是查询的第一步,来自多个 shard 上的数据集在分页返回到客户端之前会被合并到一个排序后的 list 列表,由于需要经过一步取 top N 的操作,所以 search 需要进过两个阶段才能完成,分别是 query 和 fetch。</p> <h2 id="参考资料"><a href="#参考资料" class="header-anchor">#</a> 参考资料</h2> <ul><li><a href="https://www.elastic.co/" target="_blank" rel="noopener noreferrer">Elasticsearch 官网<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://www.knowledgedict.com/tutorial/elasticsearch-index-mapping.html" target="_blank" rel="noopener noreferrer">Elasticsearch 索引映射类型及 mapping 属性详解<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <div class="page-edit"><div class="edit-link"><a href="https://github.com/dunwu/db-tutorial/edit/master/docs/12.数据库/07.搜索引擎数据库/01.Elasticsearch/04.Elasticsearch索引.md" target="_blank" rel="noopener noreferrer">📝 帮助改善此页面!</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="tags"><a href="/db-tutorial/tags/?tag=%E6%95%B0%E6%8D%AE%E5%BA%93" title="标签">#数据库</a><a href="/db-tutorial/tags/?tag=%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E%E6%95%B0%E6%8D%AE%E5%BA%93" title="标签">#搜索引擎数据库</a><a href="/db-tutorial/tags/?tag=Elasticsearch" title="标签">#Elasticsearch</a><a href="/db-tutorial/tags/?tag=%E7%B4%A2%E5%BC%95" title="标签">#索引</a></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2024/10/09, 07:16:02</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/db-tutorial/pages/0fb506/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">Elasticsearch 简介</div></a> <a href="/db-tutorial/pages/83bd15/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">Elasticsearch 查询</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
|
||
←
|
||
<a href="/db-tutorial/pages/0fb506/" class="prev">Elasticsearch 简介</a></span> <span class="next"><a href="/db-tutorial/pages/83bd15/">Elasticsearch 查询</a>→
|
||
</span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/db-tutorial/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/db-tutorial/pages/b59ba2/"><div>
|
||
HBase Java API 管理功能
|
||
<!----></div></a> <span class="date">04-13</span></dt></dl><dl><dd>02</dd> <dt><a href="/db-tutorial/pages/ce5ca0/"><div>
|
||
HBase Java API 其他高级特性
|
||
<!----></div></a> <span class="date">03-31</span></dt></dl><dl><dd>03</dd> <dt><a href="/db-tutorial/pages/c8cfeb/"><div>
|
||
HBase 数据模型
|
||
<!----></div></a> <span class="date">03-16</span></dt></dl> <dl><dd></dd> <dt><a href="/db-tutorial/archives/" class="more">更多文章></a></dt></dl></div></div></main></div> <div class="footer"><div class="icons"><a href="mailto:forbreak@163.com" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://github.com/dunwu" title="GitHub" target="_blank" class="iconfont icon-github"></a></div>
|
||
Theme by
|
||
<a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a>
|
||
| Copyright © 2019-2024
|
||
<span>钝悟(dunwu) | CC-BY-SA-4.0</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
|
||
跟随系统
|
||
</li><li class="iconfont icon-rijianmoshi">
|
||
浅色模式
|
||
</li><li class="iconfont icon-yejianmoshi">
|
||
深色模式
|
||
</li><li class="iconfont icon-yuedu">
|
||
阅读模式
|
||
</li></ul></div></div> <!----> <!----> <div class="custom-html-window custom-html-window-rb" style="display:;"><div class="custom-wrapper"><span class="close-but">×</span> <div>
|
||
<div class="wwads-cn wwads-vertical windowRB" data-id="261" style="max-width:160px;
|
||
min-width: auto;min-height:auto;"></div>
|
||
<style>
|
||
.windowRB{ padding: 0;}
|
||
.windowRB .wwads-img{margin-top: 10px;}
|
||
.windowRB .wwads-content{margin: 0 10px 40px 10px;}
|
||
.custom-html-window-rb .close-but{
|
||
display: none;
|
||
}
|
||
</style>
|
||
</div></div></div></div><div class="global-ui"><div></div></div></div>
|
||
<script src="/db-tutorial/assets/js/app.be3f2e92.js" defer></script><script src="/db-tutorial/assets/js/2.aded268b.js" defer></script><script src="/db-tutorial/assets/js/70.40a2cea2.js" defer></script>
|
||
</body>
|
||
</html>
|