Dissect HTTP elasticsearch requests
Extract out some functions and rename other functions to more clearly reflect what they do