gpt4 book ai didi

scala - ElasticSearch:Elastic4s仅索引一个字段

转载 作者:行者123 更新时间:2023-12-02 23:39:09 24 4
gpt4 key购买 nike

我正在使用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
flex 搜索1.3.2
和Scala与Play框架(2.3.4)

最佳答案

修正:我生成了一个字段图,然后执行了:

client execute {
index into "places" -> "shop" id id fields indexMap
}

关于scala - ElasticSearch:Elastic4s仅索引一个字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25789583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com