How to add nested datatype using Java api?

Below is the sample snippet:

"price":{  
           "type":"nested",  --> how to add this nested type?
           "properties":{  
              "activity_price":{  
                 "type":"double"
              },
              "multimedia_price":{  
                 "type":"double"
              },
              "transportation_price":{  
                 "type":"double"
              }
           }
        }

I want to perform nested query on it using java api but getting [nested] nested object under path [price] is not of nested type.

Currently I am using XContentBuilder.jsonBuilder() for mapping in java code.