summaryrefslogtreecommitdiff
path: root/src/engine/VyOSElasticModernFulltextStorageEngine.php
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-22 10:56:29 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-23 13:07:02 +0300
commit04acd3d6b9a95ff49d430eaf4f65aabc25282d88 (patch)
tree00e643a8a5678d4c8dcdce77afe5604860e21612 /src/engine/VyOSElasticModernFulltextStorageEngine.php
parent0b466b90271553d0c4f620e326305453a4b23dd7 (diff)
downloadphorge-elasticsearch-modern-04acd3d6b9a95ff49d430eaf4f65aabc25282d88.tar.gz
phorge-elasticsearch-modern-04acd3d6b9a95ff49d430eaf4f65aabc25282d88.zip
Engine: Add setVersion() with strict validation
Engine accepts only versions 7 and above (covering ES 7.x, 8.x, and OpenSearch 1.x/2.x/3.x via the typeless API). Anything below 7 raises with a clear message pointing at the bundled engine for ES 5 users. 🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'src/engine/VyOSElasticModernFulltextStorageEngine.php')
-rw-r--r--src/engine/VyOSElasticModernFulltextStorageEngine.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/engine/VyOSElasticModernFulltextStorageEngine.php b/src/engine/VyOSElasticModernFulltextStorageEngine.php
index f11eeab..60683b1 100644
--- a/src/engine/VyOSElasticModernFulltextStorageEngine.php
+++ b/src/engine/VyOSElasticModernFulltextStorageEngine.php
@@ -7,6 +7,27 @@
abstract class VyOSElasticModernFulltextStorageEngine
extends PhabricatorFulltextStorageEngine {
+ private $version;
+
+ public function setVersion($version) {
+ $version = (int)$version;
+ if ($version < 7) {
+ throw new Exception(
+ pht(
+ 'Unsupported Elasticsearch version "%d" for the '.
+ '"elasticsearch-modern" engine. This engine supports version 7 '.
+ 'and above (Elasticsearch 7.x, 8.x, or OpenSearch 1.x/2.x/3.x). '.
+ 'For ES 5.x, use the bundled "elasticsearch" engine instead.',
+ $version));
+ }
+ $this->version = $version;
+ return $this;
+ }
+
+ public function getVersion() {
+ return $this->version;
+ }
+
public function getEngineIdentifier() {
return 'elasticsearch-modern';
}