Potential issue with bool and nested term

I think I have found an issue with arrays of nested fields and bool matching.

I have a nested field which has multiple values where I want to search for records which have multiple values within it. If I search for a single value, it works fine. If I search for multiple values it does not.

I think I've created a somewhat minimal test case below.

curl -X PUT "localhost:9200/nested_bool?pretty=true&refresh=true" -H 'Content-Type: application/json' -d'
{
    "mappings": {
        "properties": {
            "export_commodities": {
                "type": "nested",
                "properties": {
                    "name": { "type": "text", "fields": { "keyword": { "type": "keyword" } } }
                }
            }
        }
    }
}
'

curl -X POST "localhost:9200/nested_bool/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
    "export_commodities" : [{"name": "Hydrogen Fuel"},{"name": "Animal Monitors"}]
}
'

curl -X POST "localhost:9200/nested_bool/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
    "export_commodities" : [{"name": "Hydrogen Fuel"},{"name": "Biowaste"}]
}
'

curl -X POST "localhost:9200/nested_bool/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
    "export_commodities" : {"name":" Biowaste"}
}
'

curl -X POST "localhost:9200/nested_bool/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
    "export_commodities" : [{"name": "Platinum"},{"name": "Animal Monitors"}]
}
'

This search returns nothing

curl -H 'Content-Type: application/json' -X GET "http://localhost:9200/nested_bool/_search?pretty=true&size=10" -d '
{
    "query": {
        "nested": {
            "path": "export_commodities",
            "query": {
                "bool": {
                    "filter": [
                        {
                            "term": {
                                "export_commodities.name.keyword": "Animal Monitors"
                            }
                        },
                        {
                            "term": {
                                "export_commodities.name.keyword": "Hydrogen Fuel"
                            }
                        }
                    ]
                }
            }
        }
    }
}
'

This search returns as expected

curl -H 'Content-Type: application/json' -X GET "http://localhost:9200/nested_bool/_search?pretty=true&size=10" -d '
{
    "query": {
        "nested": {
            "path": "export_commodities",
            "query": {
                "bool": {
                    "filter": [
                        {
                            "term": {
                                "export_commodities.name.keyword": "Hydrogen Fuel"
                            }
                        }
                    ]
                }
            }
        }
    }
}
'

I'm happy to register an issue on github, but I thought it would be best to ask here first in case I've missed something really obvious.

Try this instead:

GET /nested_bool/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "nested": {
            "path": "export_commodities",
            "query": {
              "term": {
                "export_commodities.name.keyword": "Animal Monitors"
              }
            }
          }
        },
        {
          "nested": {
            "path": "export_commodities",
            "query": {
              "term": {
                "export_commodities.name.keyword": "Hydrogen Fuel"
              }
            }
          }
        }
      ]
    }
  }
}

Yep that works, a little counter intuitive since the singular works but at least I can get around it. Is it worth registering an issue on github about it or is it "working as intended"?