Global highlighting settings not available in the Java API?


(seallison) #1

I'm trying to set the global highlighting settings through the Java API for
"fragment_size" and "number_of_fragments" as documented here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html#highlighting-settings

I don't see anything in SearchRequestBuilder that lets me configure those
settings. I'm working around this by setting them for each field using the
method:

searchRequestBuilder.addHighlightedField(name, fragmentSize,
numberOfFragments)

How can I configure these two settings globally for the highlighter? If it
matters, I'm using 0.90.11.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8a43a1f7-c99a-49c1-afd0-bf0de05df62c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Brian Yoder) #2

The link to the corresponding documentation for version 0.90.XX is here:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/search-request-highlighting.html#highlighting-settings

I was thinking that perhaps 0.90 did not include them, but they are also
listed in that version documentation also.

Since I haven't yet used highlighting, I will lurk on this thread and may
learn something!

Brian

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7aeff853-621f-4d2d-96fe-9b671752c4e4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #3

Just a quick untested look at the code, but you might want to try:

SearchRequestBuilder.setHighlighterOptions(options);

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e590c392-64fb-4c81-8f39-e420630f513b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(seallison) #4

Yeah I tried that too:

Map<String, Object> options = new HashMap<String, Object>();
options.put("fragment_size", 0);
options.put("number_of_fragments", 0);
searchRequestBuilder.setHighlighterOptions(options);

but the query ends up looking like this:

"highlight" : {
"options" : {
"number_of_fragments" : 0,
"fragment_size" : 0
},...

On Thursday, February 27, 2014 5:06:36 PM UTC-5, Binh Ly wrote:

Just a quick untested look at the code, but you might want to try:

SearchRequestBuilder.setHighlighterOptions(options);

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/034a9182-3160-471d-8e82-a8fd23509c19%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #5

I took a closer look and indeed you are correct, the REST API actually has
some logic in there to trickle it down to the fields level (which I didn't
expect). Can you please open a ticket?

In the meantime, I'd probably just fall back to .setSource() if absolutely
needed. Thanks!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f4e124b8-5102-4e7e-9ca1-592b04651991%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(seallison) #6

Thanks for your confirmation! I've opened a
ticket: https://github.com/elasticsearch/elasticsearch/issues/5281

On Thursday, February 27, 2014 5:41:43 PM UTC-5, Binh Ly wrote:

I took a closer look and indeed you are correct, the REST API actually has
some logic in there to trickle it down to the fields level (which I didn't
expect). Can you please open a ticket?

In the meantime, I'd probably just fall back to .setSource() if absolutely
needed. Thanks!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f1376590-62ca-4e41-bc50-fb45b4c0e551%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #7