Is there workaround for join query

(Tushar Chevulkar) #1

I am in a situation where I need to use join.

My situation is as follows:
I have a node where I have tweets for more than 50k twitter profile and increasing every day, on the other hand there are admins who are monitoring these tweets.
Now the catch is, suppose there are x number managers and each manager is only allowed to search and view data from a particular twitter users only.

Current Structure:
Right now I have 2 nodes where in first node has all the tweets by users and other is managers and the users assigned for that manager, but this operation is getting very heavy for me and data processing time is also increasing, as I add more users to the managers the query time will increase.

Tweet Data Sample:

 [{
		"id": "daksjnbdkjnbasjdkbsajd",
		"tweet": "Hi",
		"user_data": {
			"user_name": "abc",
			"user_id": 1
		}
	},
	{
		"id": "daksjnbdkjnbasdadaasjdkbsajd",
		"tweet": "Hello",
		"user_data": {
			"user_name": "xyz",
			"user_id": 2
		}
	}
]

Manager Data sample:

[{
		"id": "fiifif",
		"manger_name": "Manager 1",
		"users": [
			"1",
			"2",
		  	.....
		]
	},
	{
		"id": "lkkkf",
		"manger_name": "Manager 2",
		"users": [
			"2",
		  	....
		]
	}
]

Each managers will go up to managing 10 k users and also number of managers can also go up to 500.

I have no idea how do I solve this problem since Elasticsearch is not allowing joins.