Highlight one field twice with different fragments in one search


(locojay) #1

Hi ,

I would like to highlight a field twice :

	1 - number of fragments to 0 ==> get all highlighted
            2- number of fragments to x ==> get some fragments highlighted

in one search.

from a json perspective this will not work

curl -XGET 'http://localhost:9200/testindex_index/_search' -d '{"highlight": {"fields": {"fulltext": {"number_of_fragments": 0},"fulltext": {"number_of_fragments": 5}},"post_tags": [""],"pre_tags": [""]},"query": {"query_string": {"query": "test"}},"size": 1}'

since its a dict.

The only thing i can think of is adding another field "fulltextcopy" to my model and reindex all .

Unfortunately the fulltext field is really large and i have about 100m docs. If i am not mistaken even by setting store to false will increase the size of my data folder.

Something nice would be the ability to add for example fieldname__copy and then es would strip of __copy and call lucene highlighter on that filed.

Thanks for any suggestions


(Shay Banon) #2

Open a feature request for it. Should be simple to implement.

On Wed, Jan 5, 2011 at 4:13 AM, Jassin MEKNASSI <
jassin.meknassi@googlemail.com> wrote:

Hi ,

I would like to highlight a field twice :

           1 - number of fragments to 0 ==> get all highlighted
           2- number of fragments to x ==> get some fragments

highlighted

in one search.

from a json perspective this will not work

curl -XGET 'http://localhost:9200/testindex_index/_search' -d
'{"highlight": {"fields": {"fulltext": {"number_of_fragments":
0},"fulltext": {"number_of_fragments": 5}},"post_tags":
[""],"pre_tags": [""]},"query": {"query_string": {"query":
"test"}},"size": 1}'

since its a dict.

The only thing i can think of is adding another field "fulltextcopy" to my
model and reindex all .

Unfortunately the fulltext field is really large and i have about 100m
docs. If i am not mistaken even by setting store to false will increase the
size of my data folder.

Something nice would be the ability to add for example fieldname__copy and
then es would strip of __copy and call lucene highlighter on that filed.

Thanks for any suggestions


(system) #3