2017-04-26 1 views
0

Für die Discovery-REST-API steuert das Argument/Parameter "return", welche Felder zurückgegeben werden.In Watson Discovery begrenzt "return" ed-Felder auf Aggregationswerte

Also, wenn ich diese Argumente an die API

{ 
       "query": named_sector, 
       "count": "10", 
       "filter": filter_dates, 
       "aggregation" : "term(docSentiment.type,count:3)" 
    } 
    my_query = discovery.query(my_disc_environment_id, my_disc_collection_id, qopts) 
    print(json.dumps(my_query, indent=2)) 

passieren erhalte ich folgendes:

{ 
    "matching_results": 14779, 
    "aggregations": [ 
     { 
      "type": "term", 
      "field": "docSentiment.type", 
      "count": 3, 
      "results": [ 
       { 
        "key": "positive", 
        "matching_results": 4212 
       }, 
       { 
        "key": "negative", 
        "matching_results": 3259 
       }, 
       { 
        "key": "neutral", 
        "matching_results": 152 
       } 
      ] 
     } 
    ], 
    "results": [ 
     { 
      "id": "6389715fe7e7f711e0bc09d4f1236639", 
      "score": 1.3689895, 
      "yyyymm": "201704", 
      "url": "https://seekingalpha.com/article/4060446-valuation-dashboard-consumer-discretionary-update", 
      "enrichedTitle": null, 
      "host": "seekingalpha.com", 
      "text": "Valuation Dashboard: Consumer Discretionary - Update\n\nSummary\n\nValuation metrics in Consumer Discretionary.\n\nEvolution since last month.\n\nA list of stocks loo .... 

und viel mehr Linien. Wie beschränke ich die Ausgabe auf den Aggregationsbereich? Ist das ein Problem für mich, die JSON-Struktur, die zurückgegeben wird, besser zu behandeln?

dank

Antwort

Verwandte Themen