ES 6.8 issue with percolate search on documents with a join field

I'm working on updating ES mappings and searching within an application from 5.6 to 6.8. The relevant change around this is that I merged multi-type mapping of an index into a single type and now use a custom 'type' field along with a 'join' field labeled parent_mapping to mimic the previous behavior. One of those indexes uses a percolator. So now to the problem, I was able to recreate it in this small example I posted below. Initially I was getting a routing issue bu got passed the routing issue by adding "document": { "type": "perc_child" } when I do a percolate search. This is just a guess but I think the reason for the routing field missing message was due to the parent documents in the index not having a _routing field as these were not routed anywhere when created (only child documents are routed to be in the same shard as their parent doc). Now the issue I'm having is the percolate query is not finding the document I'm expecting for it to find. Below is the current setup I'm using to recreate the issue directly on ES 6.8.

# create index with percolator and join field
PUT /perc-index?include_type_name=true
{
  "mappings": {
    "perc" : {
      "properties": {
        "type": { "type": "keyword" },
        "message": { "type": "text" },
        "id": { "type": "integer" },
        "percolator_query": { "type": "percolator" },
        "parent_mapping": {
          "type": "join",
          "relations": {
            "perc": "perc_child"
          }
        }
      }
    }
  }
}


PUT /perc-index/perc/alert:1
{
  "percolator_query": {
    "bool": {
      "filter": [
        { "match": {
            "message": { "query": "capybara" }
          }
        }
      ]
    }
  }
}

# index parent document
PUT /perc-index/perc/1?refresh=true
{
  "id": 1,
  "type": "perc",
  "message": "perc message",
  "parent_mapping": "perc"
}

# index child document
PUT /perc-index/perc/80?routing=1
{
  "id": 80,
  "type": "perc_child",
  "message": "perc child capybara",
  "parent_mapping": {
    "name": "perc_child",
    "parent": 1
  }
}

GET /perc-index/_search
{
  "query": {
    "match_all": {}
  }
}

#send a percolate through the search api
GET /perc-index/_search
{
  "query": {
    "percolate": {
      "field": "percolator_query",
      "type": "perc",
      "routing": "1",
      "id": "80",
      "document": {
        "type": "perc_child"
      }
    }
  }
}

So in the example above I'm creating a new index, then storing a query with id alert:1. After that I create a parent and child document (using the join field and custom type to mimic old multi-type mapping). After that I search using the percolate field and am expecting for that to return the child document with id 80 but I don't get any results back.

So at this point I don't know what I'm missing or what I'm doing wrong of if there's an actual bug related to this setup in ES 6.8. Thanks in advance for any help or suggestions. I'm happy to provide more context if needed.

From what I've seen so far, trying things out and reading documentation. I don't think percolate and join fields work well together. If I could get that confirmed by someone, that'd be great.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.