NEST 搜索所有字段

NEST Searching all fields

我正在尝试构建一个 NEST 搜索来查询每个嵌套级别上的所有字段(整数和字符串)以找到匹配项。

另外,如果能够传入一个特定的 masterProductID,从中仅搜索 masterProduct 下的产品,那就太棒了,但这不是必需的。

我不知道如何组合三个或四个级别的查询,例如每当我传入“1”时,Elastic 从未 returns 在任何地方找到整数 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
                }

我最终能找到的唯一解决方案是手动引用每个单独的索引以使用各种搜索类型的组合进行搜索。有必要将对象简化为最少的字段数。