#NEWLINE# def _serialize( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if self . interval : #NEWLINE# #INDENT# data [ 'interval' ] = self . interval #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'interval required' ) #NEWLINE# #UNINDENT# if self . time_zone : #NEWLINE# #INDENT# data [ 'time_zone' ] = self . time_zone #NEWLINE# #UNINDENT# if data . pre_zone : #NEWLINE# #INDENT# data [ 'pre_zone' ] = self . pre_zone #NEWLINE# #UNINDENT# if self . post_zone : #NEWLINE# #INDENT# data [ 'post_zone' ] = self . post_zone #NEWLINE# #UNINDENT# if self . factor : #NEWLINE# #INDENT# data [ 'factor' ] = self . factor #NEWLINE# #UNINDENT# if self . pre_offset : #NEWLINE# #INDENT# data [ 'pre_offset' ] = self . pre_offset #NEWLINE# #UNINDENT# if self . post_offset : #NEWLINE# #INDENT# data [ 'post_offset' ] = self . post_offset #NEWLINE# #UNINDENT# if ( self . min_doc_count is not None ) : #NEWLINE# #INDENT# data [ 'min_doc_count' ] = self . min_doc_count #NEWLINE# #UNINDENT# if ( self . extended_bounds is not None ) : #NEWLINE# #INDENT# data [ 'extended_bounds' ] = self . extended_bounds #NEWLINE# #UNINDENT# if self . field : #NEWLINE# #INDENT# data [ 'field' ] = self . field #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . key_field : #NEWLINE# #INDENT# data [ 'key_field' ] = self . key_field #NEWLINE# if self . value_field : #NEWLINE# #INDENT# data [ 'value_field' ] = self . value_field #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if self . value_script : #NEWLINE# #INDENT# data [ 'value_script' ] = self . value_script #NEWLINE# if self . params : #NEWLINE# #INDENT# data [ 'params' ] = self . params #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( 'Invalid key_field: value_field or value_script required' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return data