Get values for specific fields in the elasticsearch index, from source

        :param fields: a list of fields that have to be retrieved from the index
        :param dataframe: if true, will return the data in the form of a pandas.DataFrame
        :returns: a list of dicts(key_val pairs) containing the values for the applied fields
                  if dataframe=True, will return the a dataframe containing the data in rows
                  and the fields representing column names

def fetch_results_from_source(self, *fields, dataframe=False):
        """
        Get values for specific fields in the elasticsearch index, from source

        :param fields: a list of fields that have to be retrieved from the index
        :param dataframe: if true, will return the data in the form of a pandas.DataFrame
        :returns: a list of dicts(key_val pairs) containing the values for the applied fields
                  if dataframe=True, will return the a dataframe containing the data in rows
                  and the fields representing column names
        """

        if not fields:
            raise AttributeError("Please provide the fields to get from elasticsearch!")

        self.reset_aggregations()

        self.search = self.search.extra(_source=fields)
        self.search = self.search.extra(size=self.size)
        response = self.search.execute()
        hits = response.to_dict()['hits']['hits']
        data = [item["_source"] for item in hits]

        if dataframe:
            df = pd.DataFrame.from_records(data)
            return df.fillna(0)
        return data