code: def query_geonames_country(self, placename, country):
          
          # first, try for an exact phrase match
          q = {"multi_match": {"query": placename,
                               "fields": ['name^5', 'asciiname^5', 'alternativenames'],
                              "type": "phrase"}}
          res = self.conn.filter("term", country_code3=country).query(q)[0:50].execute()
  
          # if no results, use some fuzziness, but still require all terms to be present.
          # Fuzzy is not allowed in "phrase" searches.
          if res.hits.total == 0:
              # tried wrapping this in a {"constant_score" : {"query": ... but made it worse
              q = {"multi_match": {"query": placename,
                                   "fields": ['name', 'asciiname', 'alternativenames'],
                                       "fuzziness": 1,
                                       "operator":   "and"}}
              res = self.conn.filter("term", country_code3=country).query(q)[0:50].execute()
          out = utilities.structure_results(res)
          return out
docs: Like query_geonames, but this time limited to a specified country.