Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >ElasticSearch 多索引

ElasticSearch 多索引

作者头像
leehao
发布于 2025-02-11 05:03:59
发布于 2025-02-11 05:03:59
10400
代码可运行
举报
文章被收录于专栏:leehaoleehao
运行总次数:0
代码可运行
代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
1、用逗号将索引隔开,如:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$ curl -XPOST http://localhost:9200/aaa,website/_search/
代码语言:javascript
代码运行次数:0
运行
复制

{

  • "took": 1,
  • "timed_out": false,
  • "_shards": {
    • "total": 10,
    • "successful": 10,
    • "failed": 0

    },

  • "hits": {
    • "total": 5,
    • "max_score": 1,
    • "hits": [
      • {
        • "_index": "website",
        • "_type": "blog",
        • "_id": "123",
        • "_score": 1,
        • "_source": {
          • "title": "My first blog entry",
          • "text": "Just trying this out...",
          • "date": "2014/01/01"

          }

        },

      • {
        • "_index": "website",
        • "_type": "blog",
        • "_id": "AVbkih8AltSLRRB7XAun",
        • "_score": 1,
        • "_source": {
          • "title": "TestTitle",
          • "text": "text",
          • "date": "2016/09/01"

          }

        },

      • {
        • "_index": "website",
        • "_type": "blog",
        • "_id": "AVbf1AtSyvALLDk8cjpY",
        • "_score": 1,
        • "_source": {
          • "title": "My 3 blog entry",
          • "text": "Still trying this out...",
          • "date": "2014/01/01"

          }

        },

      • {
        • "_index": "aaa",
        • "_type": "aaa",
        • "_id": "AVcCopjQzgrwoUDkEMu3",
        • "_score": 1,
        • "_source": {
          • "str1": "hello",
          • "str2": "world"

          }

        },

      • {
        • "_index": "aaa",
        • "_type": "aaa",
        • "_id": "AVcCogrMzgrwoUDkEMu2",
        • "_score": 1,
        • "_source": {
          • "str1": "hello, world!",
          • "str2": "goodbye! world"

          }

        }

      ]

    }

}

2、通配符

elasticsearch还支持使用统配的风格,如使用*匹配任意字符。

3、数学表达式风格

最后可以通过add(+)添加一个索引,使用remove(-)去掉一个索引

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-02-10,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Elasticsearch——分词器对String的作用
关于String类型——分词与不分词 在Elasticsearch中String是最基本的数据类型,如果不是数字或者标准格式的日期等这种很明显的类型,其他的一般都会优先默认存储成String。同样的数据类型,Elasticsearch也提供了多种存储与分词的模式,不同的模式应用于不同的场景。 很多人在初次使用Elasticsearch时,都会很纳闷... 为什么我存储的一句话,却查询不到? 为什么我输入了汉语单词,只能一个字一个字的匹配? 为什么我的url查询不到? 等等,这些都与是否分词、使用什么分词器有
用户1154259
2018/01/17
1.3K0
ElasticSearch 6.x 学习笔记:15.检索入门
15.1 准备数据 [es@node1 ~]$ vi website.json [es@node1 ~]$ cat website.json { "index":{ "_index": "website", "_type": "blog", "_id": "1" }} { "title": "Ambari源码编译","author":"程裕强","postdate":"2016-12-21","abstract":"CentOS7.x下的Ambari2.4源码编译","url":"http://url.
程裕强
2022/05/06
2020
ElasticSearch权威指南:基础入门(上)
官方网站:https://www.elastic.co/guide/index.html
HLee
2021/03/19
1.6K0
ElasticSearch权威指南:基础入门(上)
ElasticSearch 6.x 学习笔记:17.词项查询
词项查询官网: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/term-level-queries.html
程裕强
2022/05/06
1.3K0
ElasticSearch 6.x 学习笔记:16.全文检索
ElasticSearch 6.x 全文检索相关内容官方文档: https://www.elastic.co/guide/en/elasticsearch/reference/6.1/full-text-queries.html
程裕强
2022/05/06
3720
Elasticsearch 7.x:3、文档管理
(2)不指定文档ID 添加文档时可以不指定文档id,则文档id是自动生成的字符串。注意,需要使用POST方法,而不是PUT方法。
程裕强
2019/05/27
2K0
Windows下ElasticSearch学习(二)
今天继续学习ES 在Windows 下的使用,主要是通过curl 命令行来操作ES: 备注:说明一下ES 的版本为6.8.8.
Wu_Candy
2022/07/04
2690
Elasticsearch之shard、replica、扩容、容错过程
(1)index包含多个share (2)每个shard都是一个最小的工作单元,承载部分数据,lucene实例,有完整的建立索引和处理请求的能力。 (3)增删节点的时候,share会自动平衡 (4)primary shard和replica shard,没有document肯定存在在一个primary shard和replica shard,不会同时存在多个 (5)replica是primary的副本,具有容错和备份,分担读请求的功能 (6)primary在创建索引的时候就固定了,不能修改,replica可以随时修改 (7)primary shard默认是5个,replica默认是1个,那共有10个shard,5个primary,5个replica (8)primary和replica是不能再一个node的,否则节点宕机就崩了。replica就起不到容错的作用
丁D
2022/08/12
6820
Elasticsearch之shard、replica、扩容、容错过程
Elasticsearch上手——Pyt
Elasticsearch客户端列表:https://www.elastic.co/guide/en/elasticsearch/client/index.html Python API:https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/index.html 参考文档:http://elasticsearch-py.readthedocs.io/en/master/index.html
py3study
2020/01/06
4010
Elasticsearch上手——Pyt
ElasticSearch
​ 保存在某个index下,某种type的一个数据document,文档是json格式的,document就像是mysql中的某个table里面的内容。每一行对应的列叫属性
OY
2022/03/20
1.2K0
ElasticSearch
Elasticsearch探索:store 属性
默认情况下,对字段值进行索引以使其可搜索,但不存储它们 (store)。 这意味着可以查询该字段,但是无法检索原始字段值。在这里我们必须理解的一点是: 如果一个字段的 mapping 中含有 store 属性为 true,那么有一个单独的存储空间为这个字段做存储,而且这个存储是独立于 _source 的存储的。它具有更快的查询。存储该字段会占用磁盘空间。如果需要从文档中提取(即在脚本中和聚合),它会帮助减少计算。在聚合时,具有store属性的字段会比不具有这个属性的字段快。 此选项的可能值为 false 和 true。
HLee
2020/12/31
1.2K0
Elasticsearch探索:store 属性
Elasticsearch之nested object
假设我们有这么一篇文章,并且存有两个评论 PUT 54288.top:9200/website/blogs/1 { "title": "花无缺发表的一篇帖子", "content": "我是花无缺,大家要不要考虑一下投资房产和买股票的事情啊。。。", "tags": [ "投资", "理财" ], "comments": [ { "name": "小鱼儿", "comment": "什么股票啊?推荐一下呗", "age": 28, "stars": 4, "date": "2016
丁D
2022/08/12
2830
Elasticsearch——多索引的使用
在Elasticsearch中,一般的查询都支持多索引。 只有文档API或者别名等不支持多索引操作,因此本篇就翻译一下多索引相关的内容。 首先,先插入几条数据: $ curl -XPOST localhost:9200/test1/test/1 -d '{"name":"test1"}' $ curl -XPOST localhost:9200/test1/test/2 -d '{"name":"test1"}' $ curl -XPOST localhost:9200/test2/test/1 -
用户1154259
2018/01/17
9600
Elasticsearch多索引
 在Elasticsearch中,一般的查询都支持多索引。 只有文档API或者别名API等不支持多索引操作,因此本篇就翻译一下多索引相关的内容。 首先,先插入几条数据: $ curl -XPOST localhost:9200/test1/test/1 -d '{"name":"test1"}' $ curl -XPOST localhost:9200/test1/test/2 -d '{"name":"test1"}' $ curl -XPOST localhost:9200/test2/test/
用户1174963
2018/01/17
1.8K0
Elasticsearch多索引
【Elasticsearch系列九】控制台实战
类比 sql: select * from book where name like ’ %java%’ order by price desc
kwan的解忧杂货铺
2024/09/17
1180
Elasticsearch 急速入门·文档与搜索
节选自《Netkiller Database 手札》 60.2. 文档API 60.2.1. 快速上手 文档通过 _index、_type、_id 元数据(metadata),确定 URL 唯一 GET /<_index>/<_type>/<_id> # curl -XPUT 'http://localhost:9200/website/profile/1' -d '{ "name" : "neo", "nickname" : "netkiller", "age" : "35", "mes
netkiller old
2018/03/05
1.1K0
蛋疼的ElasticSearch(四)之基本用法、高级查询
ElasticSearch系列文章: 1.蛋疼的ElasticSearch(一)之安装ElasticSearch 2.蛋疼的ElasticSearch(二)之配置ElasticSearch Head插件 3.蛋疼的ElasticSearch(三)之配置elasticsearch-analysis-ik和集群
用户2032165
2018/12/04
6030
蛋疼的ElasticSearch(四)之基本用法、高级查询
ElasticSearch 6.x 学习笔记:7.文档
(2)term查询 term查询用于查找指定字段中包含指定分词的文件,只有当查询分词和文档中的分词精确匹配时才被检索到。
程裕强
2022/05/06
4800
ElasticSearch 6.x 学习笔记:7.文档
ElasticSearch 6.x 学习笔记:20.搜索排序
20.1 按照文档添加顺序排序 GET website/_search GET website/_search { "query": { "match_all": {} } } 20.2 按照文档相关度评分排序 GET website/_search { "query": { "term": { "title": { "value": "centos" } } } } 查询结果 { "took": 3, "timed_
程裕强
2022/05/06
2330
ElasticSearch 6.x 学习笔记:19.搜索高亮
参照官方文档 https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-request-highlighting.html
程裕强
2022/05/06
5200
相关推荐
Elasticsearch——分词器对String的作用
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验