Basit
Basit

Reputation: 17184

FOSElasticBundle share mapping types together

I have two mapping (User and Tasks) and when I search for tasks, I want to able to get found tasks with user information with it.

user:
    mappings:
        name: ~
        pic: ~

tasks:
    mappings: 
        content: ~
        created: ~
        user:    integer <-- ID is stored 

How can I share types / model across each other, so when I pull found task, it should also pull the user info with it.

Upvotes: 0

Views: 32

Answers (1)

Amityo
Amityo

Reputation: 6311

Elasticsearch doesn't provide a native way to 'join' doc_types. Some options:

  1. Query for the task and then the user (2 queries)
  2. Save the user data inside the tasks doc_type (1 query)

    tasks: mappings: content: ~ created: ~ user: name: pic:

Upvotes: 1

Related Questions