简体   繁体   English

NEST搜索所有字段

[英]NEST Searching all fields

I'm trying to construct a NEST search that queries all fields both integer and string on every nested level to find a match. 我正在尝试构建一个NEST搜索,该查询在每个嵌套级别上查询整数和字符串的所有字段以找到匹配项。

Additionally, being able to pass in a certain masterProductID from which only products under the masterProduct will be searched by would be fantastic, but this is not needed. 另外,能够传递某个masterProductID,从中仅搜索masterProduct下的产品是很不错的,但这不是必需的。

I can't figure out how to compound the queries for three or four levels and whenever I pass in "1" for example, Elastic never returns anywhere it found the integer 1. Both these need to be implemented and Elastic's documentation on nesting has no examples of much use. 我无法弄清楚如何复合三个或四个级别的查询,例如,每当我输入“ 1”时,Elastic都不会返回它找到整数1的任何地方。这两个都需要实现,并且Elastic的嵌套文档没有例子很多。

Below is a very condensed outline of the sort of hierarchy I'm dealing with. 以下是我正在处理的那种层次结构的简要概述。 (It's even worse than this, this is the index that was handed to me to search with). (甚至比这更糟,这是交给我进行搜索的索引)。

Is there any easy way to do this I'm missing? 有什么简单的方法可以做到这一点吗?

Thanks in advance. 提前致谢。

 "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
                }

The only solution I could find ultimately was to manually reference every individual index to search on using various compounds of search types. 我最终能找到的唯一解决方案是手动引用每个单独的索引以使用各种搜索类型的化合物进行搜索。 Simplifying the object to the minimum number of fields was necessary. 必须将对象简化为最少的字段数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM