|
1 | 1 | /**
|
2 |
| -* (C) Copyright IBM Corp. 2019, 2020. |
| 2 | +* (C) Copyright IBM Corp. 2023. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
15 | 15 | *
|
16 | 16 | */
|
17 | 17 |
|
| 18 | +using System.Collections.Generic; |
18 | 19 | using JsonSubTypes;
|
19 | 20 | using Newtonsoft.Json;
|
20 | 21 |
|
21 | 22 | namespace IBM.Watson.Discovery.v2.Model
|
22 | 23 | {
|
23 | 24 | /// <summary>
|
24 |
| - /// An abstract aggregation type produced by Discovery to analyze the input provided. |
| 25 | + /// An object that defines how to aggregate query results. |
| 26 | + /// Classes which extend this class: |
| 27 | + /// - QueryAggregationQueryTermAggregation |
| 28 | + /// - QueryAggregationQueryGroupByAggregation |
| 29 | + /// - QueryAggregationQueryHistogramAggregation |
| 30 | + /// - QueryAggregationQueryTimesliceAggregation |
| 31 | + /// - QueryAggregationQueryNestedAggregation |
| 32 | + /// - QueryAggregationQueryFilterAggregation |
| 33 | + /// - QueryAggregationQueryCalculationAggregation |
| 34 | + /// - QueryAggregationQueryTopHitsAggregation |
| 35 | + /// - QueryAggregationQueryPairAggregation |
| 36 | + /// - QueryAggregationQueryTrendAggregation |
| 37 | + /// - QueryAggregationQueryTopicAggregation |
25 | 38 | /// </summary>
|
26 | 39 | [JsonConverter(typeof(JsonSubtypes), "type")]
|
27 |
| - [JsonSubtypes.KnownSubType(typeof(QueryTermAggregation), "term")] |
28 |
| - [JsonSubtypes.KnownSubType(typeof(QueryHistogramAggregation), "histogram")] |
29 |
| - [JsonSubtypes.KnownSubType(typeof(QueryTimesliceAggregation), "timeslice")] |
30 |
| - [JsonSubtypes.KnownSubType(typeof(QueryNestedAggregation), "nested")] |
31 |
| - [JsonSubtypes.KnownSubType(typeof(QueryFilterAggregation), "filter")] |
32 |
| - [JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "min")] |
33 |
| - [JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "max")] |
34 |
| - [JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "sum")] |
35 |
| - [JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "average")] |
36 |
| - [JsonSubtypes.KnownSubType(typeof(QueryCalculationAggregation), "unique_count")] |
37 |
| - [JsonSubtypes.KnownSubType(typeof(QueryTopHitsAggregation), "top_hits")] |
38 |
| - [JsonSubtypes.KnownSubType(typeof(QueryGroupByAggregation), "group_by")] |
| 40 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryTermAggregation), "term")] |
| 41 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryGroupByAggregation), "group_by")] |
| 42 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryHistogramAggregation), "histogram")] |
| 43 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryTimesliceAggregation), "timeslice")] |
| 44 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryNestedAggregation), "nested")] |
| 45 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryFilterAggregation), "filter")] |
| 46 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryCalculationAggregation), "min")] |
| 47 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryCalculationAggregation), "max")] |
| 48 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryCalculationAggregation), "sum")] |
| 49 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryCalculationAggregation), "average")] |
| 50 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryCalculationAggregation), "unique_count")] |
| 51 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryTopHitsAggregation), "top_hits")] |
| 52 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryPairAggregation), "pair")] |
| 53 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryTrendAggregation), "trend")] |
| 54 | + [JsonSubtypes.KnownSubType(typeof(QueryAggregationQueryTopicAggregation), "topic")] |
39 | 55 | public class QueryAggregation
|
40 | 56 | {
|
| 57 | + /// This ctor is protected to prevent instantiation of this base class. |
| 58 | + /// Instead, users should instantiate one of the subclasses listed below: |
| 59 | + /// - QueryAggregationQueryTermAggregation |
| 60 | + /// - QueryAggregationQueryGroupByAggregation |
| 61 | + /// - QueryAggregationQueryHistogramAggregation |
| 62 | + /// - QueryAggregationQueryTimesliceAggregation |
| 63 | + /// - QueryAggregationQueryNestedAggregation |
| 64 | + /// - QueryAggregationQueryFilterAggregation |
| 65 | + /// - QueryAggregationQueryCalculationAggregation |
| 66 | + /// - QueryAggregationQueryTopHitsAggregation |
| 67 | + /// - QueryAggregationQueryPairAggregation |
| 68 | + /// - QueryAggregationQueryTrendAggregation |
| 69 | + /// - QueryAggregationQueryTopicAggregation |
| 70 | + protected QueryAggregation() |
| 71 | + { |
| 72 | + } |
| 73 | + |
41 | 74 | /// <summary>
|
42 |
| - /// The type of aggregation command used. Options include: term, histogram, timeslice, nested, filter, min, max, |
43 |
| - /// sum, average, unique_count, and top_hits. |
| 75 | + /// Specifies that the aggregation type is `term`. |
44 | 76 | /// </summary>
|
45 | 77 | [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
46 |
| - public string Type { get; set; } |
| 78 | + public string Type { get; protected set; } |
| 79 | + /// <summary> |
| 80 | + /// The field in the document where the values come from. |
| 81 | + /// </summary> |
| 82 | + [JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)] |
| 83 | + public string Field { get; protected set; } |
| 84 | + /// <summary> |
| 85 | + /// The number of results returned. Not returned if `relevancy:true` is specified in the request. |
| 86 | + /// </summary> |
| 87 | + [JsonProperty("count", NullValueHandling = NullValueHandling.Ignore)] |
| 88 | + public long? Count { get; protected set; } |
| 89 | + /// <summary> |
| 90 | + /// Identifier specified in the query request of this aggregation. Not returned if `relevancy:true` is specified |
| 91 | + /// in the request. |
| 92 | + /// </summary> |
| 93 | + [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)] |
| 94 | + public string Name { get; protected set; } |
| 95 | + /// <summary> |
| 96 | + /// The path to the document field to scope subsequent aggregations to. |
| 97 | + /// </summary> |
| 98 | + [JsonProperty("path", NullValueHandling = NullValueHandling.Ignore)] |
| 99 | + public string Path { get; protected set; } |
| 100 | + /// <summary> |
| 101 | + /// Number of nested documents found in the specified field. |
| 102 | + /// </summary> |
| 103 | + [JsonProperty("matching_results", NullValueHandling = NullValueHandling.Ignore)] |
| 104 | + public long? MatchingResults { get; protected set; } |
| 105 | + /// <summary> |
| 106 | + /// An array of subaggregations. |
| 107 | + /// </summary> |
| 108 | + [JsonProperty("aggregations", NullValueHandling = NullValueHandling.Ignore)] |
| 109 | + public List<Dictionary<string, object>> Aggregations { get; protected set; } |
| 110 | + /// <summary> |
| 111 | + /// The filter that is written in Discovery Query Language syntax and is applied to the documents before |
| 112 | + /// subaggregations are run. |
| 113 | + /// </summary> |
| 114 | + [JsonProperty("match", NullValueHandling = NullValueHandling.Ignore)] |
| 115 | + public string Match { get; protected set; } |
| 116 | + /// <summary> |
| 117 | + /// The value of the calculation. |
| 118 | + /// </summary> |
| 119 | + [JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)] |
| 120 | + public double? Value { get; protected set; } |
| 121 | + /// <summary> |
| 122 | + /// The number of documents to return. |
| 123 | + /// </summary> |
| 124 | + [JsonProperty("size", NullValueHandling = NullValueHandling.Ignore)] |
| 125 | + public long? Size { get; protected set; } |
| 126 | + /// <summary> |
| 127 | + /// A query response that contains the matching documents for the preceding aggregations. |
| 128 | + /// </summary> |
| 129 | + [JsonProperty("hits", NullValueHandling = NullValueHandling.Ignore)] |
| 130 | + public QueryTopHitsAggregationResult Hits { get; protected set; } |
| 131 | + /// <summary> |
| 132 | + /// Specifies the first aggregation in the pair. The aggregation must be a `term`, `group_by`, `histogram`, or |
| 133 | + /// `timeslice` aggregation type. |
| 134 | + /// </summary> |
| 135 | + [JsonProperty("first", NullValueHandling = NullValueHandling.Ignore)] |
| 136 | + public string First { get; protected set; } |
| 137 | + /// <summary> |
| 138 | + /// Specifies the second aggregation in the pair. The aggregation must be a `term`, `group_by`, `histogram`, or |
| 139 | + /// `timeslice` aggregation type. |
| 140 | + /// </summary> |
| 141 | + [JsonProperty("second", NullValueHandling = NullValueHandling.Ignore)] |
| 142 | + public string Second { get; protected set; } |
| 143 | + /// <summary> |
| 144 | + /// Indicates whether to include estimated matching result information. |
| 145 | + /// </summary> |
| 146 | + [JsonProperty("show_estimated_matching_results", NullValueHandling = NullValueHandling.Ignore)] |
| 147 | + public bool? ShowEstimatedMatchingResults { get; protected set; } |
| 148 | + /// <summary> |
| 149 | + /// Indicates whether to include total matching documents information. |
| 150 | + /// </summary> |
| 151 | + [JsonProperty("show_total_matching_documents", NullValueHandling = NullValueHandling.Ignore)] |
| 152 | + public bool? ShowTotalMatchingDocuments { get; protected set; } |
| 153 | + /// <summary> |
| 154 | + /// Specifies the `term` or `group_by` aggregation for the facet that you want to analyze. |
| 155 | + /// </summary> |
| 156 | + [JsonProperty("facet", NullValueHandling = NullValueHandling.Ignore)] |
| 157 | + public string Facet { get; protected set; } |
| 158 | + /// <summary> |
| 159 | + /// Specifies the `timeslice` aggregation that defines the time segments. |
| 160 | + /// </summary> |
| 161 | + [JsonProperty("time_segments", NullValueHandling = NullValueHandling.Ignore)] |
| 162 | + public string TimeSegments { get; protected set; } |
47 | 163 | }
|
48 | 164 |
|
49 | 165 | }
|
0 commit comments