我有点怀疑你在刷屏

1个索引上的字段扩展问题。。

Elasticsearch | 作者 szwx855 | 发布于2017年05月15日 | 阅读数:3370

有一索引/类型,ficdms/typeA,这个索引的typeA有400个字段。。现在又要加400个字段在这个typeA上,也就是这个要到800,但我觉得这样太宽了,想扩展个索引ficdmsB/typeB。
 
问题是。建立了两个索引后,查询后的结果变成两条。也就是相同的数据会出来两条。。
有没有办法合并这条数据为一条?还有,是否可以在原类型中,继续扩展400个字段?
用的是5.0.2版本:
 
1、CURL -PUT  test1/v1/_mapping

{
"properties": {
"acct_no": {
"type": "keyword"
}
},
"_routing": {
"required": true
}
}

2、CURL -PUT test2/v2/_mapping
{
"properties": {
"sex": {
"type": "keyword"
}
},
"_routing": {
"required": true
}
}

3、插入数据时,指定路由
test1/v1/123456?routing=123456 -d'{"acct_no":123456}'

test2/v2/123456?routing=123456 -d'{"sex":"M"}'



4、查询两个索引的路由
curl -xpost 'localhost:9200/test1,test2/_search
{
"query": {
"terms": {
"_routing": [
"123456"
]
}
}
}
结果是:
 
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 20,
"successful": 20,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "test1",
"_type": "v1",
"_id": "123456",
"_score": 1,
"_routing": "123456",
"_source": {
"acct_no": "123456"
}
},
{
"_index": "test2",
"_type": "v2",
"_id": "123456",
"_score": 1,
"_routing": "123456",
"_source": {
"sex": "M"
}
}
]
}
}
但我想要的是:
 
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 20,
"successful": 20,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "test1",
"_type": "v1",
"_id": "123456",
"_score": 1,
"_routing": "123456",
"_source": {
"acct_no": "123456"
"sex": "M"
}
}
]
}
}

请问各位,有什么办法么。。
 
已邀请:

szwx855 - Easy Simple

赞同来自:

顶下。。

wengqiankun - es新手

赞同来自:

parent-child  type?

要回复问题请先登录注册