Top level inner hits highlighting


(Benjamin Gathmann) #1

Hi there,

I use multiple nesting and have tried highlighting my results, but the highlighting is only returned for the innermost nest.
Here is a simplified query string (only the inner_hits part):

"inner_hits" : {
        "kids" : {
            "path" : {
                "first" : {
                    "query" : {
                        "match" : {
                            "first.a" : 123
                        }
                    },
                    "_source" : false,
                    "highlight" : {
                        "fields" : {
                            "first.a" : {}

                        }
                    },
                    "fielddata_fields" : ["first.b","first.c"],
                    "inner_hits" : {
                        "kids" : {
                            "path" : {
                                "first.second" : {
                                    "query" : {
                                        "bool" : {
                                            "filter" : {
                                                    "term" : {
                                                        "first.second.a" : "abc"
                                                    }
                                                }
                                        }
                                    },
                                    "_source" : false,
                                    "highlight" : {
                                        "fields" : {
                                                "first.second.a" : {}

                                            }
                                    },
                                    "fielddata_fields" : ["first.second.b","first.second.c"]
                                }
                            }
                        }
                    }
                }
            }
        }
    }

This returns a "highlight" object for "first.second", but not for "first".

Is it a bug or a feature?


(Benjamin Gathmann) #2

Hey, I just realized that highlighting only works (and makes sense) for string fields. So if I ask for highlighting on a long field as in my example, I won't get anything back. :slight_smile:


(system) #3