-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pattern replace by making flag optional as on api #895
Fix pattern replace by making flag optional as on api #895
Conversation
Signed-off-by: Grouh <[email protected]>
Thank you, @grouh , please add CHANGELOG entry and at least one test for the change. |
Signed-off-by: Grouh <[email protected]>
Signed-off-by: Grouh <[email protected]>
f894817
to
efe0d51
Compare
I could be wrong, but |
Hm ... I don't think so, the filter is not very useful if it replaces nothing (by and large, this is replace charfilter) |
@reta , Thank you for the reply! I don't disagree about the usefulness and I commented only because 1) the server accepts PUT my-index-000001
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
],
"filter": [
"lowercase"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "pattern_replace",
"pattern": "(?<=\\p{Lower})(?=\\p{Upper})"
}
}
}
},
"mappings": {
"properties": {
"text": {
"type": "text",
"analyzer": "my_analyzer"
}
}
}
} |
Thank you @harawata , what would be the function of the char filter when |
@reta , I just did a quick test and it seems that when For example, with this index... PUT my-index-000001
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"char_filter": [
"my_char_filter"
],
"filter": [
"lowercase"
]
}
},
"char_filter": {
"my_char_filter": {
"type": "pattern_replace",
"pattern": "Ba."
}
}
}
},
"mappings": {
"properties": {
"text": {
"type": "text",
"analyzer": "my_analyzer"
}
}
}
} ... the following returns POST my-index-000001/_analyze
{
"analyzer": "my_analyzer",
"text": "The fooBarBaz method"
} I'm still new to Elasticsearch/OpenSearch, so please forgive me if I'm missing something basic. |
Thanks @harawata , you are totally and absolutely correct in your observations (pasting below the server side code that uses empty string if value is not provided):
With that being said, I would prefer the client to require |
Personally, I am OK with that. I should, however, mention that the mismatch between server and client could cause an issue when retrieving the index. osClient.indices().get(x -> x.index("my-index-000001")); This was actually how I encountered #886 at first. |
Signed-off-by: Grouh <[email protected]>
If the consensus is to let |
I think the deserialization failure mentioned by @harawata (mismatch between server and client could cause an issue when retrieving the index) leave us no choice - we have to make |
Signed-off-by: Grouh <[email protected]>
6e3144e
to
5692fed
Compare
Signed-off-by: Grouh <[email protected]>
Thanks @reta @dblock @harawata @VachaShah |
* Fix pattern replace by making flag optional as on api Signed-off-by: Grouh <[email protected]> * Update changelog Signed-off-by: Grouh <[email protected]> * Add unit test for pattern replace char filter analyzer Signed-off-by: Grouh <[email protected]> * fix changelog Signed-off-by: Grouh <[email protected]> * fix char pattern replace by making replcement optional Signed-off-by: Grouh <[email protected]> * Add deserialze test with only pattern set Signed-off-by: Grouh <[email protected]> --------- Signed-off-by: Grouh <[email protected]> (cherry picked from commit e240b27) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix pattern replace by making flag optional as on api * Update changelog * Add unit test for pattern replace char filter analyzer * fix changelog * fix char pattern replace by making replcement optional * Add deserialze test with only pattern set --------- (cherry picked from commit e240b27) Signed-off-by: Grouh <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
This PR makes the flag optional on the pattern replace char filter, as on OS API
Issues Resolved
Fixes #886