Custom attributes

Cloud Talent Solution provides several different job attributes out-of-the-box to support the needs of various customers. To gain the best performance from Cloud Talent Solution, it's highly recommended you use the out-of-the-box fields as much as possible.

In addition, Cloud Talent Solution also provides custom attributes to store generic information. Custom attributes are used to provide even more flexibility to allow customers to support their business logic. Custom attributes store either a string or numerical information, and can be filtered against in search queries by setting appropriate filters.

Custom attributes features

  • Define your own custom field name: Define a name for a particular attribute of a job. Set this attribute to be either filterable or non-filterable depending on your needs. Typically, if the UI needs a filterable facet that is not provided out-of-the-box by Cloud Talent Solution a customAttribute can be used to provide the right filtering.
  • Case (in)sensitive search: Each search request can specify whether the search against all custom attributes is case sensitive or case insensitive.
  • Range based filtering: customAttribute search filters can filter jobs between a range of specified numeric values. For example, if a given customAttribute field is used to store the minimum GPA requirements of a job, the customAttribute search filter can be used to return jobs within a certain minimum GPA range, greater than a minimum GPA value, lesser than a minimum GPA value, etc.
  • Cross-field filtering: customAttribute also provides customers of Cloud Talent Solution with the ability to define expressions that filter a combination of custom attributes. For example, a customer has business logic that states they only want jobs that sponsor visas, or telecommute jobs. The customer stores both these fields in a different customAttribute. The customer can then specify a search filter with an expression that defines the logic needed. Only 3 levels of nested expressions are supported.

  • Keyword specific search: Specify a certain customAttribute in the keywordSearchableCustomAttributes of the associated company to ensure search requests that contain a value in the specified customAttribute return the jobs containing this value in that customAttribute.

  • SQL based searches: customAttribute allows you to define boolean-style expressions in the search request. Cloud Talent Solution automatically parses these expressions, applies the filters to the search request, and returns results accordingly. Only 3 levels of nesting of the boolean expressions and at most 2000 characters are allowed.

  • Define custom histogram buckets: Custom attributes allow customers of Cloud Talent Solution to set custom buckets by which histograms can be calculated. For example, you can use a customAttribute to store minimum GPA information, and then create a histogram on this field. You can further create buckets from 3.0 - 3.5, 3.51 - 4.0, etc., to group all the minimum GPAs within these buckets.

Using custom attributes

Create a new job with the customAttribute field (can be used with either numeric or string values):


To learn how to install and use the client library for CTS, see CTS client libraries. For more information, see the CTS Go API reference documentation.

To authenticate to CTS, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

import (

	talent ""
	money ""

// createJobWithCustomAttributes creates a job with custom attributes.
func createJobWithCustomAttributes(w io.Writer, projectID, companyID, jobTitle string) (*talentpb.Job, error) {
	ctx := context.Background()

	// Initialize a job service client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		return nil, fmt.Errorf("talent.NewJobClient: %w", err)
	defer c.Close()

	// requisitionID shoud be the unique ID in your system
	requisitionID := fmt.Sprintf("job-with-custom-attribute-%s", uuid.Must(uuid.NewV4()).String())
	jobToCreate := &talentpb.Job{
		Company:       fmt.Sprintf("projects/%s/companies/%s", projectID, companyID),
		RequisitionId: requisitionID,
		Title:         jobTitle,
		ApplicationInfo: &talentpb.Job_ApplicationInfo{
			Uris: []string{""},
		Description:     "Design, devolop, test, deploy, maintain and improve software.",
		LanguageCode:    "en-US",
		PromotionValue:  2,
		EmploymentTypes: []talentpb.EmploymentType{talentpb.EmploymentType_FULL_TIME},
		Addresses:       []string{"Mountain View, CA"},
		CustomAttributes: map[string]*talentpb.CustomAttribute{
			"someFieldString": {
				Filterable:   true,
				StringValues: []string{"someStrVal"},
			"someFieldLong": {
				Filterable: true,
				LongValues: []int64{900},
		CompensationInfo: &talentpb.CompensationInfo{
			Entries: []*talentpb.CompensationInfo_CompensationEntry{
					Type: talentpb.CompensationInfo_BASE,
					Unit: talentpb.CompensationInfo_HOURLY,
					CompensationAmount: &talentpb.CompensationInfo_CompensationEntry_Amount{
						Amount: &money.Money{
							CurrencyCode: "USD",
							Units:        1,

	// Construct a createJob request.
	req := &talentpb.CreateJobRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		Job:    jobToCreate,

	resp, err := c.CreateJob(ctx, req)
	if err != nil {
		return nil, fmt.Errorf("CreateJob: %w", err)

	fmt.Fprintf(w, "Created job with custom attributres: %q\n", resp.GetName())
	fmt.Fprintf(w, "Custom long field has value: %v\n", resp.GetCustomAttributes()["someFieldLong"].GetLongValues())

	return resp, nil


For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.


public class JobSearchCreateJobCustomAttributes {

  public static void createJob() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    String companyId = "your-company-id";
    String requisitionId = "your-unique-req-id";
    createJob(projectId, tenantId, companyId, requisitionId);

  // Create Job with Custom Attributes.
  public static void createJob(
      String projectId, String tenantId, String companyId, String requisitionId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      TenantName parent = TenantName.of(projectId, tenantId);

      // Custom attribute can be string or numeric value, and can be filtered in search queries.
      CustomAttribute customAttribute =

      Job job =
              .setTitle("Software Developer I")
              .setDescription("This is a description of this <i>wonderful</i> job!")
              .putCustomAttributes("FOR_STUDENTS", customAttribute)

      CreateJobRequest request =
      Job response = jobServiceClient.createJob(request);
      System.out.printf("Created job: %s\n", response.getName());


For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

const talent = require('@google-cloud/talent').v4;

 * Create Job with Custom Attributes
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenantd
function sampleCreateJob(
) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const companyName = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionId = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const languageCode = 'en-US';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const job = {
    company: companyName,
    requisitionId: requisitionId,
    languageCode: languageCode,
  const request = {
    parent: formattedParent,
    job: job,
    .then(responses => {
      const response = responses[0];
      console.log(`Created job: ${}`);
    .catch(err => {


For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.

from import talent

def create_job(project_id, tenant_id, company_id, requisition_id):
    """Create Job with Custom Attributes"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_id = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id = 'Job requisition ID, aka Posting ID. Unique per job.'
    # language_code = 'en-US'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(company_id, bytes):
        company_id = company_id.decode("utf-8")

    # Custom attribute can be string or numeric value,
    # and can be filtered in search queries.
    custom_attribute = talent.CustomAttribute()
    custom_attribute.filterable = True

    parent = f"projects/{project_id}/tenants/{tenant_id}"

    job = talent.Job(
        title="Software Engineer",
        description="This is a description of this job",
        custom_attributes={"FOR_STUDENTS": custom_attribute},

    response = client.create_job(parent=parent, job=job)
    print(f"Created job: {}")

By default, the searchJobs and searchJobsForAlert endpoints only search against out-of-the-box fields. If you also need to search against customAttribute fields, use the keywordSearchableJobCustomAttributes field to define a list of custom attributes to search.

For example, if a recruiter wishes to use a customAttribute "customRequisitions" to store the requisition ids of jobs particular to a specific employer, then by setting keywordSearchableJobCustomAttributes to include this field, a regular search conducted by a recruiter for "ABC123" returns all jobs that have the customAttribute "customRequisitions" with a value of "ABC123".