| 1234567891011121314151617181920212223242526272829303132 | [[index_]]== Index APIThe index API is very similar to the// {java}/java-docs-index.html[]Java index API. The Groovyextension to it is the ability to provide the indexed source using aclosure. For example:[source,groovy]--------------------------------------------------def indexR = client.index {    index "test"    type "type1"    id "1"    source {        test = "value"        complex {            value1 = "value1"            value2 = "value2"        }    }}--------------------------------------------------In the above example, the source closure itself gets transformed into anXContent (defaults to JSON). In order to change how the source closureis serialized, a global (static) setting can be set on the `GClient` bychanging the `indexContentType` field.Note also that the `source` can be set using the typical Java basedAPIs, the `Closure` option is a Groovy extension.
 |