Failed to highlight field: NullPointerException

Hi,

I have a field called "snippet" which contains text and may occur multiple
times on the root level of my document. I want to highlight two other
fields plus highlighted fragments from "snippet". Alas, sometimes it works,
sometimes it doesn't. I'm using the following highlighting definition:

"highlight": {
"fields": {
"maintitle": {},
"subtitle": {},
"snippet": {
"pre_tags": [
""
],
"post_tags": [
""
],
"fragment_size": 50,
"number_of_fragments": 10
}
}
}

I get an error like the following:

{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query_fetch], total failure; shardFailures
{[5mQh1Kr5QISWdJuk2Falzw][hrfesad][0]: FetchPh
aseExecutionException[[hrfesad][0]:
query[filtered(title:test)->cache(_type:searchdoc)],from[0],size[5],sort[<custom:"sortkey1":
org.elasticsearch.index.fi
elddata.fieldcomparator.BytesRefFieldComparatorSource@6f69a0a0>!,<custom:"sortkey2":
org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldCompara
torSource@7fb0a184>]: Fetch Failed [Failed to highlight field [snippet]]];
nested: NullPointerException; }]",
"status" : 500
}

Here, the "snippet" field seems to be problematic but sometimes also
"subtitle" is show in the error. I will try to investigate in which cases
it works, but currently I have no idea where to start.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Oh, the answer seems to be embarrasingly simple: One of the problematic
documents didn't contain a snippet field, because in the database it was
empty. I still have to verify if this is really the reason. But I think
Elasticsearch should ignore an empty field instead of throwing an exception.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.