Refactor request to Elasticsearch server and create query directory and Term Query