code: def _calc_result(self, results, calc):
          
          lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3]))
          lg.setLevel(self.log_level)
          # if the calculation is empty exit
          if calc is None:
              return results
          lg.debug("calc %s", calc)
          # perform concatenation
          hits = results.get('hits',{}).get('hits',[])
          for item in hits:
              lg.debug("\n*** item:\n%s", pp.pformat(item))
              if "+" in calc:
                  calc_parts = calc.split("+")
                  calc_str = ""
                  for i, part in enumerate(calc_parts):
                      if '"' in part:
                          calc_parts[i] = part.replace('"','')
                      else:
                          if part.startswith("_"):
                              calc_parts[i] = item.get(part)
                          else:
                              calc_parts[i] = Dot(item['_source']).get(part)
                  lg.debug(" calc result: %s", "".join(calc_parts))
                  item['_source']['__calc'] = "".join(calc_parts)
          lg.debug("calc %s", calc)
          return results
docs: parses the calc string and then reads the results and returns
          the new value Elasticsearch no longer allow dynamic in scripting
  
          args:
              results: the list of results from Elasticsearch
              calc: the calculation sting
  
          returns:
              refomated results list with calculation added to the '__calc' field
              in _source
  
          examples:
              concatenation: use + field_names and double quotes to add text
                  fld1 +", " + fld2 = "fld1, fld2"