Automatic setting of geo_point mapping type

Hi,

Having this classes:

class Location {

double lon
double lat

}
class Address {
String name
Location location
}

is there a way (via Annotations, etc) to specify that the location field
must be mapped with "geo_point" type (without generating explicitly the
mapping for the Address)?

Right now I'm doing this way:

client.admin()

            .indices()
            .preparePutMapping(DB_NAME)
            .setType(ADDRESS_TYPE_NAME)
            .setSource(XContentFactory.jsonBuilder()...)
            .execute().actionGet()

but it would be nice to skip the source generation.

If I skip the previous step (registering mapping), elasticsearch will
generate this mapping for "location" field as:

location: {

dynamic: "true",
properties: {
lat: {
type: "double"
},
lon: {
type: "double"
}
}
}

Thanks,
Mihai

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Resolved. It seems that I need to register a custom template.

Regards,
Mihai

On Wednesday, February 20, 2013 5:55:16 PM UTC+2, Mihai Cazacu wrote:

Hi,

Having this classes:

class Location {

double lon
double lat

}
class Address {
String name
Location location
}

is there a way (via Annotations, etc) to specify that the location field
must be mapped with "geo_point" type (without generating explicitly the
mapping for the Address)?

Right now I'm doing this way:

client.admin()

            .indices()
            .preparePutMapping(DB_NAME)
            .setType(ADDRESS_TYPE_NAME)
            .setSource(XContentFactory.jsonBuilder()...)
            .execute().actionGet()

but it would be nice to skip the source generation.

If I skip the previous step (registering mapping), elasticsearch will
generate this mapping for "location" field as:

location: {

dynamic: "true",
properties: {
lat: {
type: "double"
},
lon: {
type: "double"
}
}
}

Thanks,
Mihai

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.