diff --git a/README.md b/README.md index 2f54a32..3e97d65 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Advanced Object Search via Elasticsearch Advanced Object Search bundle provides advanced object search in -Pimcore backend powered by Elasticsearch. +Pimcore backend powered by Elasticsearch v6. ## Integration into Pimcore @@ -204,3 +204,7 @@ with Pimcore < 5.4, please add following rewrite rule to your `.htaccess`. # rewrite rule for pre pimcore 5.4 core static files RewriteRule ^bundles/pimcoreadmin/(.*) /pimcore/static6/$1 [PT,L] ``` + + +## Supported Elastic Search Versions +- ElasticSearch 6 \ No newline at end of file diff --git a/src/Filter/FieldDefinitionAdapter/DefaultAdapter.php b/src/Filter/FieldDefinitionAdapter/DefaultAdapter.php index 00ff353..0bc91ce 100644 --- a/src/Filter/FieldDefinitionAdapter/DefaultAdapter.php +++ b/src/Filter/FieldDefinitionAdapter/DefaultAdapter.php @@ -84,15 +84,15 @@ public function getESMapping() { [ 'properties' => [ self::ES_MAPPING_PROPERTY_STANDARD => [ - 'type' => 'string', + 'type' => 'text', 'fields' => [ - "raw" => [ "type" => "string", "index" => "not_analyzed" ] + 'raw' => [ 'type' => 'keyword' ] ] ], self::ES_MAPPING_PROPERTY_NOT_INHERITED => [ - 'type' => 'string', + 'type' => 'text', 'fields' => [ - "raw" => [ "type" => "string", "index" => "not_analyzed" ] + 'raw' => [ 'type' => 'keyword' ] ] ] ] @@ -102,9 +102,9 @@ public function getESMapping() { return [ $this->fieldDefinition->getName(), [ - 'type' => 'string', + 'type' => 'text', 'fields' => [ - "raw" => [ "type" => "string", "index" => "not_analyzed" ] + 'raw' => [ 'type' => 'keyword' ] ] ] ]; diff --git a/src/Filter/FieldDefinitionAdapter/ManyToOneRelation.php b/src/Filter/FieldDefinitionAdapter/ManyToOneRelation.php index 6387c1c..0b70992 100644 --- a/src/Filter/FieldDefinitionAdapter/ManyToOneRelation.php +++ b/src/Filter/FieldDefinitionAdapter/ManyToOneRelation.php @@ -46,16 +46,16 @@ public function getESMapping() { self::ES_MAPPING_PROPERTY_STANDARD => [ 'type' => 'nested', 'properties' => [ - 'type' => ["type" => "string", "index" => "not_analyzed"], - 'subtype' => ["type" => "string", "index" => "not_analyzed"], + 'type' => ['type' => 'keyword'], + 'subtype' => ['type' => 'keyword'], 'id' => ["type" => "long"] ] ], self::ES_MAPPING_PROPERTY_NOT_INHERITED => [ 'type' => 'nested', 'properties' => [ - 'type' => ["type" => "string", "index" => "not_analyzed"], - 'subtype' => ["type" => "string", "index" => "not_analyzed"], + 'type' => ['type' => 'keyword'], + 'subtype' => ['type' => 'keyword'], 'id' => ["type" => "long"] ] ] @@ -68,8 +68,8 @@ public function getESMapping() { [ 'type' => 'nested', 'properties' => [ - 'type' => ["type" => "string", "index" => "not_analyzed"], - 'subtype' => ["type" => "string", "index" => "not_analyzed"], + 'type' => ['type' => 'keyword'], + 'subtype' => ['type' => 'keyword'], 'id' => ["type" => "long"] ] ] diff --git a/src/Filter/FieldDefinitionAdapter/Select.php b/src/Filter/FieldDefinitionAdapter/Select.php index ae78d51..53f562e 100644 --- a/src/Filter/FieldDefinitionAdapter/Select.php +++ b/src/Filter/FieldDefinitionAdapter/Select.php @@ -39,14 +39,8 @@ public function getESMapping() { $this->fieldDefinition->getName(), [ 'properties' => [ - self::ES_MAPPING_PROPERTY_STANDARD => [ - 'type' => 'string', - 'index' => 'not_analyzed' - ], - self::ES_MAPPING_PROPERTY_NOT_INHERITED => [ - 'type' => 'string', - 'index' => 'not_analyzed' - ] + self::ES_MAPPING_PROPERTY_STANDARD => ['type' => 'keyword'], + self::ES_MAPPING_PROPERTY_NOT_INHERITED => ['type' => 'keyword'] ] ] ]; @@ -54,8 +48,7 @@ public function getESMapping() { return [ $this->fieldDefinition->getName(), [ - 'type' => 'string', - 'index' => 'not_analyzed' + 'type' => 'keyword', ] ]; } diff --git a/src/Service.php b/src/Service.php index 1733cac..3fe89f0 100644 --- a/src/Service.php +++ b/src/Service.php @@ -147,9 +147,9 @@ public function generateMapping(ClassDefinition $objectClass) { $mappingProperties = [ "o_id" => ["type" => "long"], "o_checksum" => ["type" => "long"], - "type" => ["type" => "string", "index" => "not_analyzed"], - "key" => ["type" => "string", "index" => "not_analyzed"], - "path" => ["type" => "string", "index" => "not_analyzed"] + "type" => ["type" => "keyword"], + "key" => ["type" => "keyword"], + "path" => ["type" => "keyword"] ]; foreach($fieldDefinitions as $fieldDefinition) { @@ -171,7 +171,6 @@ public function generateMapping(ClassDefinition $objectClass) { ] ]; - return $mappingParams; }