这是映射;
{
"mappings" : {
"properties" : {
"stationId" : {
"type" : "keyword"
},
"serialNo" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}}}}
这是我的弹性搜索数据;
{
"_index" : "index",
"_type" : "_doc",
"_id" : "b1597f62-01c0-4902-88b4-37a964a7777c",
"_score" : 0.0,
"_source" : {
"id" : "b1597f62-01c0-4902-88b4-37a964a7777c",
"stationId" : "06dbb312-05eb-4b0f-50ab-08d7b08d0cc7",
"serialNo" : "X"
}
},
{
"_index" : "index",
"_type" : "_doc",
"_id" : "4c833117-2d13-4533-a461-db7d3ec2be7f",
"_score" : 0.0,
"_source" : {
"id" : "4c833117-2d13-4533-a461-db7d3ec2be7f",
"stationId" : "06dbb312-05eb-4b0f-50ab-08d7b08d0cc7",
"serialNo" : "Y"
}
},
{
"_index" : "index",
"_type" : "_doc",
"_id" : "64d4f99f-7392-4b9f-a182-79f2408976f4",
"_score" : 0.0,
"_source" : {
"id" : "64d4f99f-7392-4b9f-a182-79f2408976f4",
"stationId" : "27d40749-a0f7-49af-50ac-08d7b08d0cc7",
"serialNo" : "X"
}
}
我想要基于通过入口站进入但不通过出口站的序列号的记录。我只有进出站ID信息。根据上面的数据,X和Y序列号通过入口站,但只有X序列号从出口站出来。所以对我来说,里面的数据数是1,序列号是Y。顺便说一句,我有超过50,000个唯一的序列号。