Wildcard matches are not highlighted in complex query containing field_masking_span

I'm applying the unified highlighter to the query below and the matched terms are being correctly highlighted, except by the ones matched by the wildcard term.
That happens only when there is a field_masking_span term in the query.

Here's the query:

{
  "highlight": {
    "fields": {
      "*": {
        "require_field_match": true,
        "force_source": true,
        "fragment_size": 100000,
        "pre_tags": "<res>",
        "post_tags": "</res>"
      }
    }
  },
  "query": {
    "span_near": {
      "clauses": [
        {
          "span_near": {
            "clauses": [
              {
                "span_term": {
                  "result": "election"
                }
              },
              {
                "span_near": {
                  "clauses": [
                    {
                      "span_multi": {
                        "match": {
                          "wildcard": {
                            "result": {
                              "value": "presid*"
                            }
                          }
                        }
                      }
                    },
                    {
                      "span_term": {
                        "result": "protest"
                      }
                    }
                  ],
                  "slop": 4,
                  "in_order": false
                }
              }
            ],
            "slop": 2147483647,
            "in_order": false
          }
        },
        {
          "field_masking_span": {
            "query": {
              "span_term": {
                "loaded": "yes"
              }
            },
            "field": "result"
          }
        }
      ],
      "slop": 2147483647,
      "in_order": false
    }
  }
}

The following query returns all the hightlighted results, including the wildcard matches:

{
  "highlight": {
    "fields": {
      "*": {
        "require_field_match": true,
        "force_source": true,
        "fragment_size": 100000,
        "pre_tags": "<res>",
        "post_tags": "</res>"
      }
    }
  },
  "query": {
    "span_near": {
      "clauses": [
        {
          "span_term": {
            "result": "election"
          }
        },
        {
          "span_near": {
            "clauses": [
              {
                "span_multi": {
                  "match": {
                    "wildcard": {
                      "result": {
                        "value": "presid*"
                      }
                    }
                  }
                }
              },
              {
                "span_term": {
                  "result": "protest"
                }
              }
            ],
            "slop": 4,
            "in_order": false
          }
        }
      ],
      "slop": 2147483647,
      "in_order": false
    }
  }
}

Am I missing something here?

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