Java API for require_field_match


(anhthu) #1

Hi,

I have java code like this:
.....
SearchRequestBuilder builder;
.....
builder.setFrom(getStartIndex());
builder.setSize(getEndIndex());
builder.setHighlighterPreTags("").setHighlighterPostTags("");
builder.addHighlightedField(getFieldName(),
FRAGMENT_SIZE,
NUMBER_OF_FRAGMENT);
....

But I dont know how to set "require_field_match": true in java code.
So I could build highlight in request as below:

"highlight": {
"require_field_match": true,
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"myfield": {
"fragment_size": 150,
"number_of_fragments": 15
}
}

It's really appriciated if anyone could help me on this

Thanks, Thu


(Shay Banon) #2

There isn't an option to do that, can you open an issue?

On Thu, Mar 15, 2012 at 12:47 PM, Anh Thu dinhvuanhthu@gmail.com wrote:

Hi,

I have java code like this:
.....
SearchRequestBuilder builder;
.....
builder.setFrom(getStartIndex());
builder.setSize(getEndIndex());
builder.setHighlighterPreTags("").setHighlighterPostTags("");
builder.addHighlightedField(getFieldName(),
FRAGMENT_SIZE,
NUMBER_OF_FRAGMENT);
....

But I dont know how to set "require_field_match": true in java code.
So I could build highlight in request as below:

"highlight": {
"require_field_match": true,
"pre_tags": [
""
],
"post_tags": [
""
],
"fields": {
"myfield": {
"fragment_size": 150,
"number_of_fragments": 15
}
}

It's really appriciated if anyone could help me on this

Thanks, Thu


(anhthu) #3

hi kimchy,

I've created an issue: https://github.com/elasticsearch/elasticsearch/issues/1795


(system) #4