Elastic Search - Como combinar várias cláusulas obrigatórias?

Tenho o seguinte esquema de índice para um objeto aninhado:

      "workExperiences": {
        "type": "nested",
        "properties": {
          "isCurrentWorkplace": {
            "type": "boolean"
          },
          "title": {
            "properties": {
              "id": {
                "type": "text"
              },
              "name": {
                "type": "text"
              }
            }
          }
        }
      }

Os dados para isso são os seguintes:

{
    "hits": [{
            "_source": {
                "workExperiences": [{
                        "isCurrentWorkPlace": true,
                        "title": {
                            "name": "Some name",
                            "id": 259
                        }
                    },
                    {
                        "isCurrentWorkPlace": false,
                        "title": {
                            "name": "Some other name",
                            "id": 256
                        }
                    },
                    {
                        "isCurrentWorkPlace": false,
                        "title": {
                            "name": "another name",
                            "id": 257
                        }
                    }
                ]
            }
        },
        {
            "_source": {
                "workExperiences": [{
                        "isCurrentWorkPlace": true,
                        "title": {
                            "name": "another workplace",
                            "id": 260
                        }
                    },
                    {
                        "isCurrentWorkPlace": false,
                        "title": {
                            "name": "Some other name",
                            "id": 256
                        }
                    },
                    {
                        "isCurrentWorkPlace": false,
                        "title": {
                            "name": "another name",
                            "id": 257
                        }
                    }
                ]
            }
        }
    ]
}

Agora, se eu fizer consultas simples, como encontrar um local de trabalho cujo "isCurrentWorkplace" seja verdadeiro e cujo title.id seja 259, ele funcionará perfeitamente:

{
    "from": 0,
    "size": 30,
    "_source": [
        "workExperiences.*"
    ],
    "query": {
        "bool": {
            "filter": {
                "bool": {
                    "must": [{
                        "nested": {
                            "path": "workExperiences",
                            "query": {
                                "bool": {
                                    "must": [{
                                            "term": {
                                                "workExperiences.title.id": 259
                                            }
                                        },
                                        {
                                            "term": {
                                                "workExperiences.isCurrentWorkPlace": true
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }]
                }
            }
        }
    }
}

Agora, o problema é que eu preciso combinar essas cláusulas obrigatórias. Por exemplo, preciso encontrar um registro cujo "isCurrentWorkplace" seja verdadeiro e "title.id" seja 259 cujo "isCurrentWorkplace" é falso e "title.id" é 256.

Para isso, criei a seguinte consulta:

{
    "from": 0,
    "size": 30,
    "_source": [
        "workExperiences.*"
    ],
    "query": {
        "bool": {
            "filter": {
                "bool": {
                    "must": [{
                        "nested": {
                            "path": "workExperiences",
                            "query": {
                                "bool": {
                                    "must": [{
                                            "bool": {
                                                "must": [{
                                                        "terms": {
                                                            "workExperiences.title.id": [259]
                                                        }
                                                    },
                                                    {
                                                        "term": {
                                                            "workExperiences.isCurrentWorkPlace": true
                                                        }
                                                    }
                                                ]
                                            }
                                        },
                                        {
                                            "bool": {
                                                "must": [{
                                                        "term": {
                                                            "workExperiences.title.id": 256
                                                        }
                                                    },
                                                    {
                                                        "term": {
                                                            "workExperiences.isCurrentWorkPlace": false
                                                        }
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }]
                }
            }
        }
    }
} 

Isto, no entanto, não funciona. Alguém pode me ajudar a descobrir o que estou fazendo de errado aqui?

Obrigado

questionAnswers(1)

yourAnswerToTheQuestion