Completion types with multi-fields support#34081
Conversation
107d745 to
59f7bca
Compare
|
Pinging @elastic/es-search-aggs |
There was a problem hiding this comment.
The external value is not always set by another completion mapper so you need to check the type.
I think it would be simpler to just add an input field in the CompletionInputMetaData class and do something like:
if (context.externalValueSet()) {
if (context.externalValue().getClass().equals(CompletionInputMetaData.class)) {
CompletionInputMetaData inputAndMeta = (CompletionInputMetaData) context.externalValue();
inputMap = Collections.singletonMap(inputAndMeta.input(), inputAndMeta);
} else {
inputMap = Collections.singletonMap(context.externalValue().toString(), new CompletionInputMetaData(Collections.<String, Set<CharSequence>>emptyMap(), 1));
}...
There was a problem hiding this comment.
well spotted, indeed missed these scenarios where external value is set by GeoPointFIeldMapper. Will add test cases and cover that.
good suggestion. Will extend CompletionInputMetaData to include inputField and return that as a toString
There was a problem hiding this comment.
We need a test with a context completion suggester as well.
There was a problem hiding this comment.
true, will add additional test cases to cover that
|
retest this please |
17ad68d to
55a72b5
Compare
|
@jimczi I have updated the PR, could you please take a look? |
There was a problem hiding this comment.
You can simplify this line with:
inputMap = Collections.singletonMap(fieldName, new CompletionInputMetaData(fieldName, Collections.emptyMap(), 1));
?
There was a problem hiding this comment.
absolutely, will simplify another place in that file to use jdk8 type inference as well
There was a problem hiding this comment.
Maybe input, inputField is misleading I think.
There was a problem hiding this comment.
good suggestion, this contains the actual value of the input field, so should be more clear
There was a problem hiding this comment.
Can you check that the field has the expected content?:
assertEquals("suggestion", indexableFields.getFields("completion.analyzed")[0].stringValue());
There was a problem hiding this comment.
Can you check that the field has the expected content?
There was a problem hiding this comment.
Can you check that the field has the expected content?:
There was a problem hiding this comment.
Can you check that the field has the expected content?:
There was a problem hiding this comment.
Can you check that the field has the expected content?:
There was a problem hiding this comment.
Can you check that the field has the expected content?:
There was a problem hiding this comment.
Can you check that the field has the expected content?:
There was a problem hiding this comment.
Can you check that the field has the expected content?:
Mappings with completion type and multi-fields, were not able to index array or object format on completion fields. Only string format was supproted. This is fixed by providing multiField parser with externalValueContext with already parsed object closes elastic#15115
refactor to reuse CompletionInputMetaData in externalValue Context add test cases with context completion
a795fd7 to
3bf447e
Compare
3bf447e to
e683594
Compare
40f868b to
b3be7e0
Compare
|
@jimczi updated the tests and added an additional REST test cover scenarios I couldn't test in a junit test. Can you please have a look? |
|
Thank you @jimczi |
|
going to back port to v6.5.0 |
Mappings with completion type and multi-fields, were not able to index array or object format on completion fields. Only string format was supported. This is fixed by providing multiField parser with externalValueContext with already parsed object closes elastic#15115
) Mappings with completion type and multi-fields, were not able to index array or object format on completion fields. Only string format was supported. This is fixed by providing multiField parser with externalValueContext with already parsed object * Adapt test after backport of #34081 closes #15115
Mappings with completion type and multi-fields, were not able to index array or object format on completion fields. Only string format was supported. This is fixed by providing multiField parser with externalValueContext with already parsed object closes #15115
Mappings with completion type and multi-fields, were not able to index array or
object format on completion fields. Only string format was supproted.
This is fixed by providing multiField parser with externalValueContext with already parsed object
closes #15115
gradle check?