K.Wu
K.Wu

Reputation: 3633

How to "join" 2 indices and search in ElasticSearch?

Suppose I have an index called "posts" with the following properties:

{
    "uid": "<user id>",
    "date": "<some date>",
    "message": "<some message>"
}

And another index called "users" with the following properties:

{
    "uid": "<user id>",
    "gender": "Male"
}

Now, I'm searching for posts posted by people who are males. How can I do that?

I definitely don't want to have a "user" property in a post and store the gender of the user in there. Because when a user updates his/her gender, I'd have to go to every single post that he/she has ever posted to update the gender.

Upvotes: 0

Views: 89

Answers (1)

Yashasvi Raj Pant
Yashasvi Raj Pant

Reputation: 1424

Elasticsearch doesn't support inter index relation till now. There is 'join' datatype but it supports only fields within the same index.

Upvotes: 1

Related Questions