Elasticsearch highlighting with wildcard does not work as expected Elasticsearch highlighting with wildcard does not work as expected elasticsearch elasticsearch

Elasticsearch highlighting with wildcard does not work as expected


Well, I have managed to workaround this issue (following @Will comment)When specifying explicitly all fields you want highlighting on in the query itself and setting require_field_match" : trueThe highlight works as expected :)a little strange... but works. This way it has an issue highlighting fields that are not strings, so pay attention.

 {      "from" : 0,      "size" : 10,      "query" : {        "query_string" : {          "query" : "some query",          "fields" : [ "field1", "field2", ... ],          "use_dis_max" : true        }      },      "highlight" : {        "pre_tags" : [ "<span class=\"mark\">" ],        "post_tags" : [ "</span>" ],        "order" : "score",        "encoder" : "html",        "require_field_match" : true,        "fields" : {          "*" : { }        }      }    }