Is there a way to limit the total number of highlights returned across all
fields?
I know that you can set number_of_fragments in the top level settings but
this is the same as setting it for each field (instead of limiting the
total).
{
...
"hits": [
{
"_index": "test",
"_type": "emails",
"_id": "181",
"_score": 6.82249,
"_source": {
"subject": "Upcoming event on the 25th July",
"body": "We need to prepare for the upcoming event that is going to
take place on the 25th July."
...
},
"highlight": {
"subject": [
"Upcoming event on the 25th July"
],
"body": [
"We need to prepare for the upcoming event that is..."
]
}
}
]
}
What I'm after:
{
...
"hits": [
{
"_index": "test",
"_type": "emails",
"_id": "181",
"_score": 6.82249,
"_source": {
"subject": "Upcoming event on the 25th July",
"body": "We need to prepare for the upcoming event that is going to
take place on the 25th July."
...
},
"highlight": {
"body": [
"We need to prepare for the upcoming event that is..."
]
}
}
]
}
(note only 1 highlight is returned)
No, there isn't a way to do that. Just throwing away the extra results is
generally not a big deal unless the field is very expensive to highlight.
I've found highlighting to be reasonably cheap most of the time.
Is there a way to limit the total number of highlights returned across all
fields?
I know that you can set number_of_fragments in the top level settings but
this is the same as setting it for each field (instead of limiting the
total).
{
...
"hits": [
{
"_index": "test",
"_type": "emails",
"_id": "181",
"_score": 6.82249,
"_source": {
"subject": "Upcoming event on the 25th July",
"body": "We need to prepare for the upcoming event that is going
to take place on the 25th July."
...
},
"highlight": {
"subject": [
"Upcoming event on the 25th July"
],
"body": [
"We need to prepare for the upcoming event that is..."
]
}
}
]
}
What I'm after:
{
...
"hits": [
{
"_index": "test",
"_type": "emails",
"_id": "181",
"_score": 6.82249,
"_source": {
"subject": "Upcoming event on the 25th July",
"body": "We need to prepare for the upcoming event that is going
to take place on the 25th July."
...
},
"highlight": {
"body": [
"We need to prepare for the upcoming event that is..."
]
}
}
]
}
(note only 1 highlight is returned)
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.