0

几天以来,我一直坚持这一点,任何帮助都将是非常可观的。

我们实际上是如何从 Jest 客户端的结果对象中检索文档的

我正在使用以下代码

List<Hit<Part,Void>> hits =  searchresult.getHits(Part.class);
            for (SearchResult.Hit<Part,Void> hit : hits) {

在 Part PPOJO 类中,我有一个变量属性

private Object attributes;

这是属性字段的映射,它是对象类型。

 "attributes": {
                  "properties": {
                     "AttrCatgId": {
                        "type": "long"
                     },
                     "AttrCatgText": {
                        "type": "text",
                        "fields": {
                           "keyword": {
                              "type": "keyword",
                              "ignore_above": 256
                           }
                        }
                     },
                     "AttrText": {
                        "type": "text",
                        "fields": {
                           "keyword": {
                              "type": "keyword",
                              "ignore_above": 256
                           }
                        }
                     },
                     "AttributeId": {
                        "type": "long"
                     }
                  }
               }

现在,当我从结果对象中检索文档时,它会以双精度格式提供值(默认情况下附加 .0)

{AttrText=3/4 TON, AttrCatgText=LOAD RATING, AttrCatgId=3.0, AttributeId=11.0}

如何以这种格式获取 AttrText=3/4 TON、AttrCatgText=LOAD RATING、AttrCatgId=3、AttributeId=11 值。

提前感谢您的帮助。

这是示例文档。

       "catalogLineCode": "G12",
       "supplierId": [
          5904
       ],
       "partId": 5278493,
       "partGrpName": "Thermostat, Gasket & Housing",
       "terminologyName": "Rear Right Wheel Cylinder",
       "catalogName": "EPE",
       "catId": [
          10
       ],
       "perCarQty": 1,
       "catalogId": 1,
       "partGrpId": 10,
       "regionId": 1,
       "partNumber": "12T1B",
       "attributes": [
          {
             "AttrText": "3/4 TON",
             "AttrCatgText": "LOAD RATING",
             "AttrCatgId": 3,
             "AttributeId": 11
          },
          {
             "AttrText": "M ENG CODE",
             "AttrCatgText": "ENG SOURCE CODE",
             "AttrCatgId": 16,
             "AttributeId": 111
          },
          {
             "AttrText": "4 WHEEL/ALL WHEEL DRIVE",
             "AttrCatgText": "DRIVE TYPE",
             "AttrCatgId": 27,
             "AttributeId": 168
          }
       ],
       "vehicleId": [
          5274
       ],
       "extendedDescription": "ALTERNATE TEMP - ALL MAKES-STD LINE~STD CAB - BASE",
       "terminologyId": 20
4

0 回答 0