API Stability Long-Term

The addFieldAliasMapping() GraphQL mutation can be used to add a field alias mapping to an existing schema. It returns the unique identifier of the alias mapping — if successful.

For more information on dashboards, see the Dashboards & Widgets documentation page.

Syntax

Below is the syntax for the addFieldAliasMapping() mutation field:

graphql
addFieldAliasMapping(
      input: AddAliasMappingInput!
    ): string!

Below is an example of how this mutation field might be used:

Show:
graphql
mutation {
  addFieldAliasMapping(
      schemaId: "123", 
      aliasMapping: {
        name: "ECS for HAProxy", 
        tags: [ {name: "kind", value: "logs"}, 
                {name: "repo", value: "github"} ],
        aliases: [ {source: "port", alias: "source.port"} ]
      } 
  )
}
Example Responses
Show:
json
{
  "data": {
    "addFieldAliasMapping": "c9vjksYPrvvGneUEjkkUFdyOKf9bcjvn"
  },
}

Given Datatypes

AddAliasMappingInput has a couple of parameters:

Table: AddAliasMappingInput

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 17, 2024
aliasMappingAliasMappingInputyes Long-TermThe alias mapping to be added to the schema. See AliasMappingInput.
schemaIdstringyes Long-TermThe unique identifier of the schema on which the alias mapping exists.

Example addFieldAliasMapping() Mutations

To create a new field alias mapping:

Show:
graphql
mutation {
  addFieldAliasMapping(
      schemaId: "123", 
      aliasMapping: {
        name: "ECS for HAProxy", 
        tags: [ {name: "kind", value: "logs"}, 
                {name: "repo", value: "github"} ],
        aliases: [ {source: "port", alias: "source.port"} ]
      } 
  )
}
Example Responses
Show:
json
{
  "data": {
    "addFieldAliasMapping": "c9vjksYPrvvGneUEjkkUFdyOKf9bcjvn"
  },
}

This mutation performs the action as when adding a new alias mapping for an individual field, as detailed on the Field Aliasing page.

The alias configuration from the above query, as shown within the UI is shown below:

Interaction Context Menu