Skip to content

Fix and tune synonyms API #2235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
299 changes: 138 additions & 161 deletions output/schema/schema.json

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions output/schema/validation-errors.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 30 additions & 34 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions specification/synonyms/_types/SynonymRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
*/

import { Id } from '@_types/common'
import { OverloadOf } from '@spec_utils/behaviors'

export type SynonymString = string

// Synonym Rule with optional ID, used for PUT method
export class SynonymRuleOptionalId {
export class SynonymRule {
/**
* Synonym Rule identifier
*/
Expand All @@ -34,9 +35,13 @@ export class SynonymRuleOptionalId {
}

// Synonym Rule with mandatory ID, used for responses (which always include it)
export class SynonymRule extends SynonymRuleOptionalId {
export class SynonymRuleRead implements OverloadOf<SynonymRule> {
/**
* Synonym Rule identifier
*/
id: Id
/**
* Synonyms, in Solr format, that conform the synonym rule. See https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#_solr_synonyms_2
*/
synonyms: SynonymString
}
36 changes: 0 additions & 36 deletions specification/synonyms/_types/SynonymsSet.ts

This file was deleted.

8 changes: 6 additions & 2 deletions specification/synonyms/_types/SynonymsUpdateResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export class SynonymsUpdateResult {
* Updating synonyms in a synonym set reloads the associated analyzers.
* This is the analyzers reloading result
*/
reload_analyzers_details: ReloadDetails[]
_shards: ShardStatistics
reload_analyzers_details: ReloadAnalyzersDetails
}

export class ReloadAnalyzersDetails {
_shard: ShardStatistics
reload_details: ReloadDetails[]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { Name } from '@_types/common'
import { Id } from '@_types/common'

/**
* Deletes a synonym set
Expand All @@ -30,6 +30,6 @@ interface Request extends RequestBase {
/**
* The id of the synonyms set to be deleted
*/
id: Name
id: Id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { Name } from '@_types/common'
import { Id } from '@_types/common'

/**
* Deletes a synonym rule in a synonym set
Expand All @@ -30,11 +30,11 @@ interface Request extends RequestBase {
/**
* The id of the synonym set to be updated
*/
set_id: Name
set_id: Id

/**
* The id of the synonym rule to be deleted
*/
rule_id: Name
rule_id: Id
}
}
11 changes: 6 additions & 5 deletions specification/synonyms/get_synonym/SynonymsGetRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { Name } from '@_types/common'
import { SynonymsSet } from '../_types/SynonymsSet'
import { Id } from '@_types/common'
import { integer } from '@_types/Numeric'

/**
Expand All @@ -32,15 +31,17 @@ interface Request extends RequestBase {
/**
* "The id of the synonyms set to be retrieved
*/
id: Name
id: Id
}
query_parameters: {
/**
* Starting offset for query rules to be retrieved (default: 0)
* Starting offset for query rules to be retrieved
* @server_default 0
*/
from?: integer
/**
* specifies a max number of query rules to retrieve (default: 10)
* specifies a max number of query rules to retrieve
* @server_default 10
*/
size?: integer
}
Expand Down
7 changes: 2 additions & 5 deletions specification/synonyms/get_synonym/SynonymsGetResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
* under the License.
*/

import { Result } from '@_types/Result'
import { ReloadDetails } from '@indices/reload_search_analyzers/types'
import { ShardStatistics } from '@_types/Stats'
import { integer } from '@_types/Numeric'
import { SynonymsSet } from '../_types/SynonymsSet'
import { SynonymRuleRead } from '../_types/SynonymRule'

export class Response {
body: {
count: integer
synonyms_set: SynonymsSet
synonyms_set: SynonymRuleRead[]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { RequestBase } from '@_types/Base'
import { Name } from '@_types/common'
import { Id } from '@_types/common'

/**
* Retrieves a synonym rule from a synonym set
Expand All @@ -30,11 +30,11 @@ interface Request extends RequestBase {
/**
* The id of the synonym set to retrieve the synonym rule from
*/
set_id: Name
set_id: Id

/**
* The id of the synonym rule to retrieve
*/
rule_id: Name
rule_id: Id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { SynonymRule } from '../_types/SynonymRule'
import { SynonymRuleRead } from '../_types/SynonymRule'

export class Response {
body: SynonymRule
body: SynonymRuleRead
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ import { integer } from '@_types/Numeric'
interface Request extends RequestBase {
query_parameters: {
/**
* Starting offset (default: 0)
* Starting offset
* @server_default 0
*/
from?: integer
/**
* specifies a max number of results to get (default: 10)
* specifies a max number of results to get
* @server_default 10
*/
size?: integer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
*/

import { integer } from '@_types/Numeric'
import { Name } from '@_types/common'
import { Id } from '@_types/common'

export class Response {
body: {
count: integer
results: SynonymsSetListItem[]
results: SynonymsSetItem[]
}
}

export class SynonymsSetListItem {
export class SynonymsSetItem {
/**
* Synonyms set name
* Synonyms set identifier
*/
synonyms_set: Name
synonyms_set: Id
/**
* Number of synonym rules that the synonym set contains
*/
Expand Down
Loading