【发布时间】:2022-10-25 06:43:05
【问题描述】:
我想按字段过滤数据库中的项目,并返回每个过滤器的计数。 Example is when I select to return specific brand names I want to see the number of brand name available.
有没有我可以使用的搜索服务,比如 Azure 搜索,或者在 NestJs 和 mongodb 中实现它的方法
这是数据库集合
{
"brand": "Screaming Eagle, The Flight",
"producer": "Screaming Eagle",
"productionCountry": "America",
"region": "Napa Valley",
"appellation": "Oakville",
"vintage": "2016",
"grape": "Cabernet Sauvignon",
"maturity": "25",
"case": "3 bottles",
"origin": "SECONDARYMARKET",
"type": "Red"
},{
"brand": "Joseph Phelps, Insignia",
"producer": "Joseph Phelps",
"productionCountry": "America",
"region": "Napa Valley",
"appellation": "St. Helena",
"vintage": "2012",
"grape": "Cabernet Sauvignon",
"maturity": "25",
"case": "6 bottles",
"origin": "SECONDARYMARKET",
"type": "Red"
},{
"brand": "Joseph Phelps, Insignia",
"producer": "Joseph Phelps",
"productionCountry": "America",
"region": "Napa Valley",
"appellation": "St. Helena",
"vintage": "2012",
"grape": "Cabernet Sauvignon",
"maturity": "25",
"case": "6 bottles",
"origin": "SECONDARYMARKET",
"type": "Red"
},{
"brand": "Continuum",
"producer": "Continuum",
"productionCountry": "America",
"region": "Napa Valley",
"appellation": "Oakville",
"vintage": "2017",
"grape": "Cabernet Sauvignon",
"maturity": "26",
"case": "6 bottles",
"origin": "SECONDARYMARKET",
"type": "Red"
},{
"brand": "Continuum",
"producer": "Continuum",
"productionCountry": "America",
"region": "Napa Valley",
"appellation": "Oakville",
"vintage": "2017",
"grape": "Cabernet Sauvignon",
"maturity": "26",
"case": "6 bottles",
"origin": "SECONDARYMARKET",
"type": "Red"
}
【问题讨论】:
标签: mongodb elasticsearch search nestjs azure-cognitive-search