I'm using nodejs/express for a webapp and storing data in elastic search. I would like to put something like the user profile in elastic search, and when I pull it out call methods on it. I'm used to Java/C# so I would expect to do something like
var user = new User(elasticSearchResult)
user.getUserRoles()
The constructor would parse the data and the class would contain all the methods I need.