elasticsearch-查询多个索引是可能的吗?

2024-01-25

我有一个包含 3 个索引的 elasticsearch 集群:

/users/user
/events/visit
/events/register
/pages/page

所以,现在我需要运行处理多个索引的查询。

Eg: 获取第X页注册用户的性别。 (要获取此信息,我需要来自多个索引的信息。)

这可能吗?也许集成hadoop?


这在 Elasticsearch 本身中非常简单!每当您指定索引时,都可以用逗号分隔其他索引。

curl -XGET 'http://localhost:9200/index1,index2/_search?q=yourQueryHere'

您还可以使用 _all 搜索所有索引。

curl -XGET 'http://localhost:9200/_all/_search?q=yourQueryHere'

以下是来自 elasticsearch 网站的一些有用文档。这个网站有大量信息,但有时很难找到,IMO。

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

elasticsearch-查询多个索引是可能的吗? 的相关文章

随机推荐