Scala ElasticSearch:Elastic4s仅索引一个字段
我正在使用ElasticSearch为我的一些模型编制索引,但我发现只有一个字段Scala ElasticSearch:Elastic4s仅索引一个字段,scala,
elasticsearch,elastic4s,Scala,
elasticsearch,Elastic4s,我正在使用ElasticSearch为我的一些模型编制索引,但我发现只有一个字段更新了被编制了索引 我首先创建了一个映射,如下所示 client execute { create index "places" mappings( "shop" as ( "location" typed GeoPointType, "available" typed BooleanType, "posted" typed DateType, "updat
更新了
被编制了索引
我首先创建了一个映射,如下所示
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
}
}
但是,当我转到主机: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
使用Play框架(2.3.4)修复了Scala:我生成了一个字段地图,然后做了:
client execute {
index into "places" -> "shop" id id fields indexMap
}