diff --git a/config/schema/elasticsearch_connector.backend.schema.yml b/config/schema/elasticsearch_connector.backend.schema.yml index f3c7296..7910945 100644 --- a/config/schema/elasticsearch_connector.backend.schema.yml +++ b/config/schema/elasticsearch_connector.backend.schema.yml @@ -1,4 +1,4 @@ -elasticsearch_connector.backend.plugin.elasticsearch: +plugin.plugin_configuration.search_api_backend.elasticsearch: type: mapping label: 'Search API Elasticsearch settings' mapping: @@ -9,6 +9,9 @@ elasticsearch_connector.backend.plugin.elasticsearch: cluster: type: string label: 'The cluster that handles the connection' + fuzziness: + type: string + label: 'Fuzziness' scheme: type: string label: 'The HTTP protocol to use for sending queries' diff --git a/config/schema/elasticsearch_connector.cluster.schema.yml b/config/schema/elasticsearch_connector.cluster.schema.yml index 8179925..0f88e0b 100644 --- a/config/schema/elasticsearch_connector.cluster.schema.yml +++ b/config/schema/elasticsearch_connector.cluster.schema.yml @@ -24,6 +24,39 @@ elasticsearch_connector.cluster.*: multiple_nodes_connection: type: boolean label: 'Multiple Nodes Connection' + use_authentication: + type: boolean + label: 'Use HTTP authentication method to connect to Elasticsearch.' + authentication_type: + type: string + label: 'HTTP authentication type' + username: + type: string + label: 'The username for authentication' + password: + type: string + label: 'The password for authentication' + timeout: + type: integer + label: 'Connection timeout, in seconds' + rewrite: + type: mapping + label: 'Options for altering the index name' + mapping: + rewrite_index: + type: boolean + label: 'Whether to alter the index name' + index: + type: mapping + label: 'Index-specific options for rewrite' + mapping: + prefix: + type: string + label: 'Prefix to use for the final index name' + suffix: + type: string + label: 'Suffix to use for the final index name' + locked: type: boolean label: 'Locked' diff --git a/tests/src/Kernel/ClusterSchemaTest.php b/tests/src/Kernel/ClusterSchemaTest.php new file mode 100644 index 0000000..cd1f23d --- /dev/null +++ b/tests/src/Kernel/ClusterSchemaTest.php @@ -0,0 +1,68 @@ +cluster = Cluster::create([ + 'cluster_id' => 'test_cluster', + 'name' => 'Test cluster', + 'status' => TRUE, + 'url' => 'http://elasticsearch:9200', + 'proxy' => '', + 'options' => [ + 'multiple_nodes_connection' => FALSE, + 'use_authentication' => TRUE, + 'authentication_type' => 'Basic', + 'username' => 'some_username', + 'password' => 'test1234', + 'timeout' => 5, + 'rewrite' => [ + 'rewrite_index' => TRUE, + 'index' => [ + 'prefix' => '', + 'suffix' => '', + ], + ], + ], + 'locked' => FALSE, + ]); + $this->cluster->save(); + } + + /** + * Tests that the cluster schema definition is valid. + */ + public function testClusterSchema() { + $config_name = 'elasticsearch_connector.cluster.test_cluster'; + $config_data = $this->config($config_name)->get(); + $config_typed = \Drupal::service('config.typed'); + $this->assertTrue($this->checkConfigSchema($config_typed, $config_name, $config_data), 'Cluster schema is valid'); + } +}