如何对情绪值预测和置信度进行聚合

问题描述 投票:0回答:1

嗨,我希望你做得很好,我想对情绪执行聚合查询,但我在 kibana 中执行以下查询时得到空结果。

{
  "size": 0,
  "aggs": {
    "sentiment_stats": {
      "terms": {
        "field": "sentiment.keywords"
      }
    },
    "total_predictions": {
      "sum": {
        "field": "predictions.keyword"
      }
    }
  }
}

这是下面给出的简单文档。我想计算预测聚合。在预测中,我有以下类别,如中性、负面正面等

{
   "_source":{
      "id":"",
      "author":{
         "entity_type":"post",
         "username":"toyotapakistanofficial",
         "id":"toyotapakistanofficial",
         "name":"Toyota Pakistan",
         "url_c":"",
         "image":[
           
         ]
      },
      "target":{
         "entity_type":"page",
         "username":"toyotapakistanofficial",
         "id":"",
         "name":"Toyota Pakistan",
         "url":"",
         "image":"https://scontent.fisb1-2.fna.fbcdn.net/v/t39.30808-1/318613074_2269545816559690_2555827927620099181_n.jpg?stp=dst-jpg_p200x200&_nc_cat=1&ccb=1-7&_nc_sid=5f2048&_nc_ohc=tFsWfA5qsO4AX8d8B0A&_nc_ht=scontent.fisb1-2.fna&cb_e2o_trans=q&oh=00_AfDLWo_btSY-atwX18C7IZeaIwKZAgBsxw85SONNZ_-nMg&oe=65613591",
         "url_c":""
      },
      "tags":"",
      "url_c":"https://www.facebook.com/toyotapakistanofficial/posts/pfbid02bdJaX7Vz1XdhZf4KaXEt5CFscjoeTcJouFDWT8MSQkPsZuu2evN3ZUnnbqdHCv2cl?__cft__[0]=AZUTQP6jV6SLsGP37O47XSD7GLxNbr5seDktH2r0_GIYgvFSQvm2Yds3sbTpYj2IdO3WTHSTz8kSmpmae2avdPKXdWlJoRm-IeFgj3QedewQVVOI2ACfjLcSA62fx6up2dptMCWPUTz4DEWu0t8euq75IJ0KzsL1qcyOQxi-sv6v5w7G2Xr_034ZOkIY7p8gZHg&__tn__=%2CO%2CP-R",
      "associated_links":"",
      "headline":"",
      "timestamp_c":1693940400,
      "content_type":{
         "is_picture":true,
         "is_text":true,
         "is_video":false,
         "is_shared":false
      },
      "text_c":"Have you availed the Toyota Azaadi Deal yet?  ",
      "media_c":[
         
      ],
      "impressions":{
         "no_of_reactions_c":0,
         "no_of_comments_c":"12",
         "no_of_shares":"16"
      },
      "reactions":[
         
      ],
      "comments":[
         
      ],
      "shared_post":{
         "author":{
            
         },
         "content_type":{
            
         },
         "headline":"",
         "id":"",
         "media":[
            
         ],
         "target":{
            
         },
         "text":"",
         "timestamp":"",
         "url":"",
         "video_links":""
      },
      "target_information":{
         "target_type":"facebook",
         "target_subtype":"page",
         "GTR":"st_fb_21824",
         "CTR":"1",
         "uid":"7a587cfa-006c-4cf9-b604-bfe64d241e90",
         "username":"toyotapakistanofficial",
         "case_id":"1191"
      },
      "data_type":"facebook_page_posts",
      "kafka_id":"23a47ed3-e051-42fb-a145-5a4ff582eb93",
      "@timestamp":"2023-11-21 07:42:08",
      "Categories":{
         "confidence":[
            0.15142688155174255,
            0.6153247356414795
         ],
         "predictions":[
            "Economy"
         ]
      },
      "emotion":{
         "confidence":[
            "0.20653119683265686"
         ],
         "predictions":[
            "Indifferent"
         ]
      },
      "facial_id":"",
      "hashtags":[
         
      ],
      "mentions":[
         
      ],
      "ner":{
         "entities":[
            "Toyota Azaadi"
         ],
         "labels":[
            "PRODUCT"
         ]
      },
      "object_detection":[
         
      ],
      "sentiment":{
         "confidences":"",
         "predictions":[
            "Neutral"
         ],
         "confidence":[
            "0.4066358804702759"
         ]
      },
      "target_subtype":"",
      "target_type":"",
      "text_categories":{
         "confidences":"",
         "predictions":""
      },
      "topic":"",
      "valid":"",
      "weapon_detection":{
         "confidence":0.0,
         "is_weapon_detected":"",
         "predictions":"",
         "urls":""
      },
      "is_ai_applied":true,
      "sub_categories":{
         "predictions":[
            "Trade"
         ]
      }
   }
}

你能告诉我如何获得预测计数吗

elasticsearch kibana elastic-stack
1个回答
0
投票

这可能与“大小”:0有关。

根据官方文档: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html

size
(Optional, integer) Defines the number of hits to return. Defaults to 10.

By default, you cannot page through more than 10,000 hits using 
the from and size parameters. 
To page through more hits, use the search_after parameter.

这是另一个来源:

https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html

由于我无法在本地重现此问题,因此我建议您仔细检查对象和数组的聚合。情绪是一个对象,而预测是一个数组。

© www.soinside.com 2019 - 2024. All rights reserved.