Browse files

Merge pull request #359 from jappievw/dynamic_mapping_template

Dynamic mapping template (enhanced test)
  • Loading branch information...
ruflin committed Apr 3, 2013
2 parents 062c7c6 + 3d5a09c commit 4439efcfec40469d7009972021acccea4bb3392d
Showing with 12 additions and 0 deletions.
  1. +12 −0 test/lib/Elastica/Test/Type/MappingTest.php
@@ -212,6 +212,18 @@ public function testDynamicTemplate()
// read the mapping from Elasticsearch and assert that the field is "not_analyzed"
$newMapping = $type->getMapping();
+ $this->assertArrayHasKey('person', $newMapping,
+ 'Person type not available in mapping from ES. Mapping set at all?');
+ $this->assertArrayHasKey('properties', $newMapping['person'],
+ 'Person type doesnt have any properties. Document properly added?');
+ $this->assertArrayHasKey('multiname', $newMapping['person']['properties'],
+ 'The multiname property is not added to the mapping. Document properly added?');
+ $this->assertArrayHasKey('fields', $newMapping['person']['properties']['multiname'],
+ 'The multiname field of the Person type is presumably not a multi_field type. Dynamic mapping not applied?');
+ $this->assertArrayHasKey('org', $newMapping['person']['properties']['multiname']['fields'],
+ 'The multi* matcher did not create a mapping for the property when indexing the document.');
+ $this->assertArrayHasKey('index', $newMapping['person']['properties']['multiname']['fields']['org'],
+ 'Indexing status of the not available. Dynamic mapping not fully applied!');
$this->assertEquals('not_analyzed', $newMapping['person']['properties']['multiname']['fields']['org']['index']);

0 comments on commit 4439efc

Please sign in to comment.