Skip to content

Commit be3b927

Browse files
committed
Configure UpdateForV10 tag with eslint-plugin-jsdoc
We sometimes want to make breaking changes but have to wait until the next major version. To not forget about those, this commit introduces an UpdateForV10 JSDoc tag that can be used in any commment. There are a few benefits of using JSDoc instead of a simple TODO comment: * With the allowlist of tags in our eslint config, we can't make typos * We enforce a proper description to explain why the breaking change needs to be made Note that this tag has the same name as the Elasticsearch UpdateForV10 annotation, as we'll migrate to Elasticsearch in the future.
1 parent 0a319e4 commit be3b927

File tree

44 files changed

+587
-233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+587
-233
lines changed

docs/modeling-guide.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,3 +785,12 @@ class Foo {
785785
#### `@stability` and `@visibility`
786786
787787
These annotations have been removed, use `@availability` instead.
788+
789+
#### `@UpdateForV10`
790+
791+
We sometimes want to make breaking changes but have to wait until the next major version.
792+
To not forget about those change, you can use the UpdateForV10 JSDoc tag in any commment.
793+
There are a few benefits of using JSDoc instead of a simple TODO comment:
794+
795+
* With the allowlist of tags in our eslint config, we can't make typos
796+
* We enforce a proper description to explain why the breaking change needs to be made

specification/_global/index/IndexRequest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,14 @@ import { Duration } from '@_types/Time'
146146
* "id": "elkbee"
147147
* }
148148
* }
149-
*
149+
* ```
150+
*
150151
* In this example, the operation will succeed since the supplied version of 2 is higher than the current document version of 1.
151152
* If the document was already updated and its version was set to 2 or higher, the indexing command will fail and result in a conflict (409 HTTP status code).
152153
*
153154
* A nice side effect is that there is no need to maintain strict ordering of async indexing operations run as a result of changes to a source database, as long as version numbers from the source database are used.
154155
* Even the simple case of updating the Elasticsearch index using data from a database is simplified if external versioning is used, as only the latest version will be used if the index operations arrive out of order.
156+
*
155157
* @rest_spec_name index
156158
* @availability stack stability=stable
157159
* @availability serverless stability=stable visibility=public

specification/_global/search_template/SearchTemplateRequest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ export interface Request extends RequestBase {
122122
*/
123123
scroll?: Duration
124124
/**
125-
* The type of the search operation. */
125+
* The type of the search operation.
126+
*/
126127
search_type?: SearchType
127128
/**
128129
* If `true`, `hits.total` is rendered as an integer in the response.

specification/_global/update_by_query/UpdateByQueryResponse.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export class Response {
3232
* If this is non-empty then the request ended because of those failures.
3333
* Update by query is implemented using batches.
3434
* Any failure causes the entire process to end, but all failures in the current batch are collected into the array.
35-
* You can use the `conflicts` option to prevent reindex from ending when version conflicts occur. */
35+
* You can use the `conflicts` option to prevent reindex from ending when version conflicts occur.
36+
*/
3637
failures?: BulkIndexByScrollFailure[]
3738
/** The number of documents that were ignored because the script used for the update by query returned a noop value for `ctx.op`. */
3839
noops?: long
@@ -43,7 +44,8 @@ export class Response {
4344
/**
4445
* The number of retries attempted by update by query.
4546
* `bulk` is the number of bulk actions retried.
46-
* `search` is the number of search actions retried. */
47+
* `search` is the number of search actions retried.
48+
*/
4749
retries?: Retries
4850
task?: TaskId
4951
/** If true, some requests timed out during the update by query. */
@@ -60,8 +62,10 @@ export class Response {
6062
/** The number of milliseconds the request slept to conform to `requests_per_second`. */
6163
throttled_millis?: DurationValue<UnitMillis>
6264
throttled_until?: Duration
63-
/** This field should always be equal to zero in an _update_by_query response.
64-
* It only has meaning when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to `requests_per_second`. */
65+
/**
66+
* This field should always be equal to zero in an _update_by_query response.
67+
* It only has meaning when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to `requests_per_second`.
68+
*/
6569
throttled_until_millis?: DurationValue<UnitMillis>
6670
}
6771
}

specification/_spec_utils/UserDefinedValue.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* under the License.
1818
*/
1919

20-
/** Rather then documenting `object` this specifies places in the response that depend on the mapping and or request
21-
* e.g the result of a script can be anything from value types to objects */
20+
/**
21+
* Rather then documenting `object` this specifies places in the response that depend on the mapping and or request
22+
* e.g the result of a script can be anything from value types to objects
23+
*/
2224
export class UserDefinedValue {}

specification/_types/Knn.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export interface KnnSearch {
4343
k?: integer
4444
/** The number of nearest neighbor candidates to consider per shard */
4545
num_candidates?: integer
46-
/** The percentage of vectors to explore per shard while doing knn search with bbq_disk
46+
/**
47+
* The percentage of vectors to explore per shard while doing knn search with bbq_disk
4748
* @availability stack since=9.2.0
4849
* @availability serverless
4950
*/
@@ -59,7 +60,8 @@ export interface KnnSearch {
5960
* @doc_id knn-inner-hits
6061
*/
6162
inner_hits?: InnerHits
62-
/** Apply oversampling and rescoring to quantized vectors
63+
/**
64+
* Apply oversampling and rescoring to quantized vectors
6365
* @availability stack since=8.18.0
6466
* @availability serverless
6567
*/
@@ -78,7 +80,8 @@ export interface KnnQuery extends QueryBase {
7880
query_vector_builder?: QueryVectorBuilder
7981
/** The number of nearest neighbor candidates to consider per shard */
8082
num_candidates?: integer
81-
/** The percentage of vectors to explore per shard while doing knn search with bbq_disk
83+
/**
84+
* The percentage of vectors to explore per shard while doing knn search with bbq_disk
8285
* @availability stack since=9.2.0
8386
* @availability serverless
8487
*/
@@ -89,7 +92,8 @@ export interface KnnQuery extends QueryBase {
8992
filter?: QueryContainer | QueryContainer[]
9093
/** The minimum similarity for a vector to be considered a match */
9194
similarity?: float
92-
/** Apply oversampling and rescoring to quantized vectors
95+
/**
96+
* Apply oversampling and rescoring to quantized vectors
9397
* @availability stack since=8.18.0
9498
* @availability serverless
9599
*/

specification/_types/Retriever.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,16 @@ export class KnnRetriever extends RetrieverBase {
124124
k: integer
125125
/** Number of nearest neighbor candidates to consider per shard. */
126126
num_candidates: integer
127-
/** The percentage of vectors to explore per shard while doing knn search with bbq_disk
127+
/**
128+
* The percentage of vectors to explore per shard while doing knn search with bbq_disk
128129
* @availability stack since=9.2.0
129130
* @availability serverless
130131
*/
131132
visit_percentage?: float
132133
/** The minimum similarity required for a document to be considered a match. */
133134
similarity?: float
134-
/** Apply oversampling and rescoring to quantized vectors
135+
/**
136+
* Apply oversampling and rescoring to quantized vectors
135137
* @availability stack since=8.18.0
136138
* @availability serverless
137139
*/
@@ -144,7 +146,10 @@ export class KnnRetriever extends RetrieverBase {
144146
export class RRFRetrieverComponent {
145147
/** The nested retriever configuration. */
146148
retriever: RetrieverContainer
147-
/** Weight multiplier for this retriever's contribution to the RRF score. Higher values increase influence. Defaults to 1.0 if not specified. Must be non-negative. @server_default 1.0 */
149+
/**
150+
* Weight multiplier for this retriever's contribution to the RRF score. Higher values increase influence. Defaults to 1.0 if not specified. Must be non-negative.
151+
* @server_default 1.0
152+
*/
148153
weight?: float
149154
}
150155

@@ -176,7 +181,8 @@ export class TextSimilarityReranker extends RetrieverBase {
176181
inference_text: string
177182
/** The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text. */
178183
field: string
179-
/** Whether to rescore on only the best matching chunks.
184+
/**
185+
* Whether to rescore on only the best matching chunks.
180186
* @availability stack since=9.2.0 stability=beta
181187
* @availability serverless stability=beta
182188
*/

specification/_types/TokenPruningConfig.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@
2020
import { float, integer } from '@_types/Numeric'
2121

2222
export class TokenPruningConfig {
23-
/** Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned.
23+
/**
24+
* Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned.
2425
* @server_default 5
2526
*/
2627
tokens_freq_ratio_threshold?: integer
27-
/** Tokens whose weight is less than this threshold are considered nonsignificant and pruned.
28+
/**
29+
* Tokens whose weight is less than this threshold are considered nonsignificant and pruned.
2830
* @server_default 0.4
2931
*/
3032
tokens_weight_threshold?: float
31-
/** Whether to only score pruned tokens, vs only scoring kept tokens.
33+
/**
34+
* Whether to only score pruned tokens, vs only scoring kept tokens.
3235
* @server_default false
3336
*/
3437
only_score_pruned_tokens?: boolean

specification/_types/aggregations/Aggregate.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ export class HistogramBucket extends MultiBucketBase {
451451
key: double
452452
}
453453

454-
/** @variant name=date_histogram
454+
/**
455+
* @variant name=date_histogram
455456
* @ext_doc_id search-aggregations-bucket-datehistogram-aggregation
456457
*/
457458
export class DateHistogramAggregate extends MultiBucketAggregateBase<DateHistogramBucket> {}

specification/_types/aggregations/AggregationContainer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ export class AggregationContainer {
457457
* Sampling provides significant speed improvement at the cost of accuracy.
458458
* @ext_doc_id search-aggregations-random-sampler-aggregation
459459
* @availability stack since=8.1.0 stability=experimental
460-
461460
*/
462461
random_sampler?: RandomSamplerAggregation
463462
/**

0 commit comments

Comments
 (0)