code: def _get_proper_elastic_search_date_rounding_format(partial_date):
      
      es_date_math_unit = ES_DATE_MATH_ROUNDING_YEAR
  
      if partial_date.month:
          es_date_math_unit = ES_DATE_MATH_ROUNDING_MONTH
      if partial_date.day:
          es_date_math_unit = ES_DATE_MATH_ROUNDING_DAY
  
      return es_date_math_unit
docs: Returns the proper ES date math unit according to the "resolution" of the partial_date.
  
      Args:
          partial_date (PartialDate): The partial date for which the date math unit is.
  
      Returns:
          (str): The ES date math unit format.
  
      Notes:
          This is needed for supporting range queries on dates, i.e. rounding them up or down according to
          the ES range operator.
          For example, without this, a query like 'date > 2010-11', would return documents with date '2010-11-15', due to
          the date value of the query being interpreted by ES as '2010-11-01 01:00:00'. By using the suffixes for rounding
          up or down, the date value of the query is interpreted as '2010-11-30T23:59:59.999', thus not returning the
          document with date '2010-11-15', as the user would expect. See:
          https://www.elastic.co/guide/en/elasticsearch/reference/6.1/query-dsl-range-query.html#_date_math_and_rounding