我正在尝试构建一个NEST搜索,它在每个嵌套级别查询整数和字符串的所有字段以查找匹配项。
此外,能够传入某个masterProductID,其中只搜索masterProduct下的产品会很棒,但这不是必需的。
我无法弄清楚如何将查询复合为三个或四个级别,每当我传入“1”时,Elastic永远不会返回它找到整数的任何地方1.这两个都需要实现,而Elastic的嵌套文档没有很多用途的例子。
下面是我正在处理的层次结构的非常简洁的轮廓。 (它甚至比这更糟糕,这是交给我搜索的索引)。
我有什么简单的方法可以做到这一点吗?
提前致谢。
"masterProductId":2
"manufacturerId" : 1
"productAttributes": [
{
"masterProductId": 2,
"attributeTypeName": "Storage",
"attributeTypeId": 2,
"attributeName": "16GB",
"attributeId": 4,
"productId": 1124,
"attributeSortOrder": 2,
"attributeTypeSortOrder": 1,
"attributeNameUrl": "16gb"
},
{
"masterProductId": 2,
"attributeTypeName": "Condition",
"attributeTypeId": 5,
"attributeName": "Refurbished Good",
"value": "Excellent condition with very minor, isolated wear and tear",
"attributeId": 30,
"productId": 1124,
"attributeSortOrder": 3,
"attributeTypeSortOrder": 4,
"attributeNameUrl": "refurbished-good"
}
"products": [
{
"masterProductId": 2,
"productId": 37,
"basePrice": 110,
"websitePriceIncTax": 110,
"productImages": [
{
"productImageId": 0,
"masterProductId": 2,
"productId": 37,
"name": "Apple iPhone 4s White",
"productImageTypeId": 2,
"productImageTypeName": "Front",
"imageExtension": "jpg",
"fileName": "front-appleiphone4swhite.jpg",
"fileNameThumb": "front-appleiphone4swhite-thumb.jpg",
"isDefault": true
}
我能找到的唯一解决方案是手动引用每个索引来搜索使用各种搜索类型的化合物。将对象简化为最小数量的字段是必要的。