简体   繁体   English

Elasticsearch中有多个索引/类型吗?

[英]More than one index/type in Elasticsearch?

Following the documentation's canonical example, say I want to store tweets in elasticsearch, but I want to specify an endpoint that handles more than two fields, eg 按照文档的规范示例,说我想在tweetsearch中存储推文,但是我想指定一个处理两个以上字段的端点,例如

/tweets/some_twitter_handle/some_month/tweet/id

In this example, I want to index on tweets , but also on some_twitter_handle and some_month , with tweet type, and some id . 在此示例中,我要在tweetssome_twitter_handle索引,还要在tweet类型和some id上的some_twitter_handlesome_monthsome_twitter_handle索引。

Is this possible, or is the only possible mapping something akin to what they provide, with one index and one type , eg /tweets/tweet/id ? 这是可能的,还是唯一可能的映射类似于它们提供的内容的,具有一个index和一种type映射,例如/tweets/tweet/id

The index/type/id is what determines which shard a document ends up on (in the absense of other routing information). 索引/类型/标识是确定文档最终存储在哪个分片上的信息(缺少其他路由信息)。 Elasticsearch indexes every field by default (you can control this through a mapping if you don't want some of your field indexed). 默认情况下,Elasticsearch为每个字段建立索引(如果您不想为某些字段建立索引,则可以通过映射进行控制)。 So by putting a "twitter_handle": "whatever" into the document, it becomes searchable by that "twitter_handle". 因此,通过将"twitter_handle": "whatever"放入文档中,就可以通过该“ twitter_handle”进行搜索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM