added path support, see http://www.elasticsearch.org/guide/reference/mapping/id-field/
This commit is contained in:
parent
814460dbf2
commit
50730cca3d
|
@ -281,6 +281,7 @@ class Configuration implements ConfigurationInterface
|
|||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->append($this->getIdNode())
|
||||
->append($this->getMappingsNode())
|
||||
->append($this->getSourceNode())
|
||||
->append($this->getBoostNode())
|
||||
|
@ -435,6 +436,23 @@ class Configuration implements ConfigurationInterface
|
|||
$nestings[$property] = array_merge_recursive($nestings[$property], $this->getNestingsForType($field[$property]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array node used for "_id".
|
||||
*/
|
||||
protected function getIdNode()
|
||||
{
|
||||
$builder = new TreeBuilder();
|
||||
$node = $builder->root('_id');
|
||||
|
||||
$node
|
||||
->children()
|
||||
->scalarNode('path')->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array node used for "_source".
|
||||
*/
|
||||
|
|
|
@ -197,6 +197,9 @@ class FOSElasticaExtension extends Extension
|
|||
$typeDef->addMethodCall('setSerializer', array(array(new Reference($callbackId), 'serialize')));
|
||||
}
|
||||
$container->setDefinition($typeId, $typeDef);
|
||||
if (isset($type['_id'])) {
|
||||
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_id'] = $type['_id'];
|
||||
}
|
||||
if (isset($type['_source'])) {
|
||||
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_source'] = $type['_source'];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue