我正在使用 ElasticSearch 来索引我的一些模型,但我看到只有一个字段updated
被索引;
我首先创建一个映射,例如;
client execute {
create index "places" mappings(
"shop" as (
"location" typed GeoPointType,
"available" typed BooleanType,
"posted" typed DateType,
"updated" typed DateType
)
)
}
然后,在方法Shop.save
中,我执行以下操作;
posted = new Date
updated = new Date
super.save
// index in ES
client execute {
index into "places" -> "shop" id id fields {
"location" -> GeoPoint.parseFromLatLon(lat.toString + "," + lon.toString)
"available" -> true
"posted" -> posted // field in the object
"updated" -> updated // field in the object
}
}
但是,当我去 时host:9200/places/shop/1
,我只看到:
{
_index: "places",
_type: "shop",
_id: "1",
_version: 1,
found: true,
_source: {
updated: "2014-09-11T13:52:40.072Z"
}
}
我究竟做错了什么?
编辑我正在使用:elastic4s 1.3.2 elasticsearch 1.3.2 和 Scala with the Play Framework (2.3.4)