简体   繁体   中英

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

/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 .

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 ?

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). So by putting a "twitter_handle": "whatever" into the document, it becomes searchable by that "twitter_handle".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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