Skip to content
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dafbf90
Add timeout to SynonymsManagementAPIService put synonyms
carlosdelest Apr 4, 2025
a5a8a75
Remove replicas 0, as that may impact serverless
carlosdelest Apr 4, 2025
6e57ae3
Add timeout to put synonyms action, fix tests
carlosdelest Apr 4, 2025
7dee4b5
Fix number of replicas
carlosdelest Apr 4, 2025
19b5c33
Remove cluster.health checks for synonyms index
carlosdelest Apr 4, 2025
fcf4dc6
Revert debugging
carlosdelest Apr 4, 2025
51f67eb
Add integration test for timeouts
carlosdelest Apr 4, 2025
ab0805d
Use TimeValue instead of an int
carlosdelest Apr 4, 2025
3b8bbfd
Add YAML tests and REST API specs
carlosdelest Apr 4, 2025
8da7611
Fix a validation bug in put synonym rule
carlosdelest Apr 4, 2025
4ab01af
Spotless
carlosdelest Apr 4, 2025
6245d57
Update docs/changelog/126314.yaml
carlosdelest Apr 4, 2025
baca84c
Remove unnecessary checks for null
carlosdelest Apr 4, 2025
fbe393f
Fix equals / HashCode
carlosdelest Apr 4, 2025
a3dca50
Checks that timeout is passed correctly to the check health method
carlosdelest Apr 4, 2025
1ecfb12
Use correctly the default timeout
carlosdelest Apr 4, 2025
b419e4c
spotless
carlosdelest Apr 4, 2025
eaeaaf7
Add monitor cluster privilege to internal synonyms user
carlosdelest Apr 4, 2025
8fef96c
[CI] Auto commit changes from spotless
Apr 4, 2025
8d3e221
Add capabilities to avoid failing on bwc tests
carlosdelest Apr 4, 2025
0044e80
Merge remote-tracking branch 'carlosdelest/bugfix/synonyms-index-sear…
carlosdelest Apr 4, 2025
733aa81
[CI] Auto commit changes from spotless
Apr 4, 2025
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
6 changes: 6 additions & 0 deletions docs/changelog/126314.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 126314
summary: Add timeout to synonyms put APIs to wait for synonyms to be accessible
area: Analysis
type: bug
issues:
- 121441
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
}
]
},
"params": {
"timeout": {
"type": "time",
"description": "Explicit timeout for the operation to complete"
}
},
"body": {
"description": "Synonyms set rules",
"required": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
}
]
},
"params": {
"timeout": {
"type": "time",
"description": "Explicit timeout for the operation to complete"
}
},
"body": {
"description": "Synonym rule",
"required": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ setup:

- match: { result: "created" }

- do:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We no longer need to do an explicit wait in tests, as it is done in the PUT operations themselves

cluster.health:
index: .synonyms
wait_for_status: green

- do:
synonyms.get_synonym:
id: test-update-synonyms
Expand Down Expand Up @@ -63,18 +58,29 @@ setup:

- match: { result: "created" }

- do:
cluster.health:
index: .synonyms
wait_for_status: green

- do:
synonyms.get_synonym:
id: test-empty-synonyms

- match: { count: 0 }
- match: { synonyms_set: [] }

---
"Timeout can be specified":
- do:
synonyms.put_synonym:
id: test-update-synonyms
timeout: 10s
body:
synonyms_set:
- synonyms: "hello, hi"
- synonyms: "bye => goodbye"
id: "test-id"

- match: { result: "created" }
- match: { reload_analyzers_details._shards.total: 0 }
- length: { reload_analyzers_details.reload_details: 0 }

---
"Validation fails tests":
- do:
Expand Down Expand Up @@ -116,3 +122,13 @@ setup:
body:
synonyms_set:
- synonyms: "bye, goodbye, "

- do:
catch: /as a time value:\ negative durations are not supported/
synonyms.put_synonym:
id: test-update-synonyms
timeout: -100s
body:
synonyms_set:
- synonyms: "bye, goodbye"

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ setup:
synonyms_set:
synonyms: "foo => bar, baz"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

- do:
indices.create:
index: test_index
Expand Down Expand Up @@ -372,13 +366,6 @@ setup:
synonyms_set:
synonyms: "foo => bar, baz"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green


- do:
indices.stats: { index: test_index }

Expand Down Expand Up @@ -441,12 +428,6 @@ setup:
synonyms_set:
synonyms: "foo => bar, baz"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

- do:
# Warning issued in previous versions
allowed_warnings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ setup:
- synonyms: "test => check"
id: "test-id-3"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

---
"Get synonyms set":
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ setup:
- synonyms: "bye => goodbye"
id: "test-id-2"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

---
"Delete synonyms set":
- do:
Expand Down Expand Up @@ -77,7 +71,6 @@ setup:
settings:
index:
number_of_shards: 1
number_of_replicas: 0
analysis:
filter:
my_synonym_filter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ setup:
- synonyms: "hello, hi"
- synonyms: "goodbye, bye"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

- do:
synonyms.put_synonym:
id: test-synonyms-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ setup:
- synonyms: "test => check"
id: "test-id-3"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

---
"Update a synonyms rule":
- do:
Expand Down Expand Up @@ -85,3 +79,69 @@ setup:
rule_id: "test-id-0"
body:
synonyms: "i-phone, iphone"

---
"Timeout can be specified":
Copy link
Member Author

@carlosdelest carlosdelest Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These general validation tests were missing - adding them and the timeout validation tests

- do:
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
timeout: 10s
body:
synonyms: "i-phone, iphone"

- match: { result: "created" }
- match: { reload_analyzers_details._shards.total: 0 }
- length: { reload_analyzers_details.reload_details: 0 }

---
"Validation failure tests":
- do:
catch: /\[synonyms\] field can't be empty/
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
body:
synonyms: ""

- do:
catch: /More than one explicit mapping specified in the same synonyms rule/
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
body:
synonyms: "bye => => goodbye"

- do:
catch: /Incorrect syntax for \[synonyms\]/
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
body:
synonyms: " => goodbye"

- do:
catch: /Incorrect syntax for \[synonyms\]/
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
body:
synonyms: "bye => "

- do:
catch: /Incorrect syntax for \[synonyms\]/
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
body:
synonyms: "bye, goodbye, "

- do:
catch: /as a time value:\ negative durations are not supported/
synonyms.put_synonym_rule:
set_id: "test-synonyms"
rule_id: "test-id-0"
timeout: -100s
body:
synonyms_set:
- synonyms: "bye, goodbye"
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ setup:
- synonyms: "test => check"
id: "test-id-3"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

---
"Get a synonym rule":
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ setup:
- synonyms: "test => check"
id: "test-id-3"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

---
"Delete synonym rule":
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ setup:
- synonyms: "bye => goodbye"
id: "synonym-rule-2"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

# Create an index with synonym_filter that uses that synonyms set
- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ setup:
- synonyms: "bye => goodbye"
id: "synonym-rule-2"

# This is to ensure that all index shards (write and read) are available. In serverless this can take some time.
- do:
cluster.health:
index: .synonyms
wait_for_status: green

# Create synonyms synonyms_set2
- do:
synonyms.put_synonym:
Expand Down
Loading
Loading