How to create a MappingType for a property with multi-fields in OpenSearch Java Client

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

OpenSearch Java Client 2.x

Describe the issue:
I am trying to create a index that has multi-fields using opensearch Java Client. I couldn’t find a way to specify this.

For example, in the following mappings property “city” has “keyword” field that has “keyworkd” type.

  "mappings": {
    "properties": {
      "city": {
        "type": "text",
        "fields": {
          "keyword": { 
            "type":  "keyword"
          }
        }
      }
    }
  }

I don’t know how to add “keyword” fields to the TypeMapping in OpenSearch Java Client:


    TypeMapping mappings = new TypeMapping.Builder()
                              .properties("city", new Property.Builder().text(new TextProperty.Builder().build()).build()) ...  
                              .build()

Thanks for any help.

Configuration:

Relevant Logs or Screenshots: