Benjamin Kovach
Benjamin Kovach

Reputation: 3260

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, e.g.

/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, e.g /tweets/tweet/id?

Upvotes: 0

Views: 183

Answers (1)

Alcanzar
Alcanzar

Reputation: 17155

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

Upvotes: 1

Related Questions