code: func (q *RegexpQuery) Source() (interface{}, error) {
  	source := make(map[string]interface{})
  	query := make(map[string]interface{})
  	source["regexp"] = query
  
  	x := make(map[string]interface{})
  	x["value"] = q.regexp
  	if q.flags != "" {
  		x["flags"] = q.flags
  	}
  	if q.maxDeterminizedStates != nil {
  		x["max_determinized_states"] = *q.maxDeterminizedStates
  	}
  	if q.boost != nil {
  		x["boost"] = *q.boost
  	}
  	if q.rewrite != "" {
  		x["rewrite"] = q.rewrite
  	}
  	if q.queryName != "" {
  		x["name"] = q.queryName
  	}
  	query[q.name] = x
  
  	return source, nil
  }
docs: // Source returns the JSON-serializable query data.