I need to build a multiple-entity search.
I don't want every T1, then every T2.
When I use fos:lastica:populate
, I get an error:
Rejecting mapping update to [search_dev] as the final mapping would have more than 1 type: [t1, t2]
My mapping:
fos_elastica:
clients:
default:
host: %elastic_host%
port: %elastic_port%
indexes:
search:
finder: ~
client: default
index_name: search_%kernel.environment%
types:
t1:
indexable_callback: 'getEnabled'
properties:
id:
type: integer
name: ~
persistence:
driver: orm
model: AppBundle\Entity\T1
finder: ~
listener:
logger: true
elastica_to_model_transformer:
ignore_missing: true
t2:
indexable_callback: 'getEnabled'
properties:
id:
type: integer
name: ~
persistence:
driver: orm
model: AppBundle\Entity\T2
finder: ~
listener:
logger: true
elastica_to_model_transformer:
ignore_missing: true
My service:
$search = $this->indexManager->getIndex('search')->createSearch();
$search->addType('t1');
$search->addType('t2');
$resultSet = $search->search($query);
$results = $this->modelTransformer->transform($resultSet->getResults());
Did I miss something? Can I map 2 types in 1 index?