Skip to content
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 mapping char_filter when mapping a hashtag #7591

Merged
merged 1 commit into from Jun 16, 2023

Conversation

nathanmyles
Copy link
Contributor

@nathanmyles nathanmyles commented May 16, 2023

Description

Fix the mapping char_filter to allow mapping hashtags, example:

from elasticsearch_dsl import analyzer, char_filter


STD_WITH_SPECIAL_CHARS: Final = analyzer(
    'std_with_hashtag_chars',
    type='custom',
    tokenizer='standard',
    filter=['lowercase'],
    char_filter=char_filter(
        'hashtag_char_filter',
        type='mapping',
        mappings=[
            '# => _hashsign_',
        ],
    ),
)

More details in the issue below.

Related Issues

Resolves: #7308

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@nathanmyles nathanmyles force-pushed the fix-mapping-hashtag branch 2 times, most recently from 022c01c to 13131f3 Compare May 17, 2023 16:12
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Merging #7591 (1e421f9) into main (df517a6) will decrease coverage by 0.10%.
The diff coverage is 100.00%.

❗ Current head 1e421f9 differs from pull request most recent head e83bf87. Consider uploading reports for the commit e83bf87 to get more accurate results

@@             Coverage Diff              @@
##               main    #7591      +/-   ##
============================================
- Coverage     70.84%   70.75%   -0.10%     
+ Complexity    56508    56114     -394     
============================================
  Files          4721     4680      -41     
  Lines        267470   266072    -1398     
  Branches      39211    39069     -142     
============================================
- Hits         189477   188247    -1230     
+ Misses        61970    61844     -126     
+ Partials      16023    15981      -42     
Impacted Files Coverage Δ
...n/java/org/opensearch/index/analysis/Analysis.java 83.96% <100.00%> (-0.13%) ⬇️

... and 639 files with indirect coverage changes

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change we have two code paths, one that removes comments and another that doesn't. Why? In what cases would one want both behaviors? What tests break if you get rid of supporting comments altogether?

Assuming the answer is "we don't need comments", for 3.0 we could just do it. Then we can discuss options for backporting this into 2.x, for example we could tream # => as something special.

Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testReplicaHasDiffFilesThanPrimary
      1 org.opensearch.remotestore.SegmentReplicationUsingRemoteStoreIT.testPitCreatedOnReplica
      1 org.opensearch.indices.replication.SegmentReplicationAllocationIT.testSingleIndexShardAllocation

@nathanmyles
Copy link
Contributor Author

@dblock I think this PR is pretty much good to go, just hitting some pipeline instability. I've been rebasing when I can, hopefully it'll be resolved soon.

@nathanmyles
Copy link
Contributor Author

@dblock Looks like the checks are all green now, though I haven't rebased this today. Is this good to go now? Or should I rebase this again today?

@dblock dblock merged commit e049338 into opensearch-project:main Jun 16, 2023
10 checks passed
@dblock
Copy link
Member

dblock commented Jun 16, 2023

Merged, thank you. Watch the backports for failures, might need manual ones.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-1.x 1.x
# Navigate to the new working tree
pushd ../.worktrees/backport-1.x
# Create a new branch
git switch --create backport/backport-7591-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e049338c714db77517c5e8bb94b6b24a7b0a3281
# Push it to GitHub
git push --set-upstream origin backport/backport-7591-to-1.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-1.x

Then, create a pull request where the base branch is 1.x and the compare/head branch is backport/backport-7591-to-1.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-7591-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e049338c714db77517c5e8bb94b6b24a7b0a3281
# Push it to GitHub
git push --set-upstream origin backport/backport-7591-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7591-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.3 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-1.3 1.3
# Navigate to the new working tree
pushd ../.worktrees/backport-1.3
# Create a new branch
git switch --create backport/backport-7591-to-1.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e049338c714db77517c5e8bb94b6b24a7b0a3281
# Push it to GitHub
git push --set-upstream origin backport/backport-7591-to-1.3
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-1.3

Then, create a pull request where the base branch is 1.3 and the compare/head branch is backport/backport-7591-to-1.3.

@dblock
Copy link
Member

dblock commented Jun 16, 2023

Backports will need to be manual :( will you do them please @nathanmyles ?

@nathanmyles
Copy link
Contributor Author

Backports will need to be manual :( will you do them please @nathanmyles ?

Yep, I'll look at these. I'll link the PRs to this one. Let me know if there's anything special I should do.

nathanmyles added a commit to nathanmyles/OpenSearch that referenced this pull request Jun 16, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
(cherry picked from commit e049338)
@nathanmyles
Copy link
Contributor Author

@dblock Created the backport for 1.3: #8121

Let me know if this looks correct and I'll do the rest.

kartg pushed a commit that referenced this pull request Jun 19, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: #7308
(cherry picked from commit e049338)
@kartg
Copy link
Member

kartg commented Jun 19, 2023

@nathanmyles #8121 has been merged. Please create similar backport PRs for t 1.x and 2.x branches. Thank you!

nathanmyles added a commit to nathanmyles/OpenSearch that referenced this pull request Jun 19, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
(cherry picked from commit e049338)
nathanmyles added a commit to nathanmyles/OpenSearch that referenced this pull request Jun 19, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
(cherry picked from commit e049338)
@nathanmyles
Copy link
Contributor Author

@kartg Created the other backport PRs, let me know if there's anything else I need to do.

Also, would you know when this change would make it into the AWS opensearch versions?

kartg pushed a commit that referenced this pull request Jun 19, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: #7308
(cherry picked from commit e049338)
kartg pushed a commit that referenced this pull request Jun 19, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: #7308
(cherry picked from commit e049338)
gaiksaya pushed a commit to gaiksaya/OpenSearch that referenced this pull request Jun 26, 2023
…) (opensearch-project#8146)

Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
(cherry picked from commit e049338)
@dblock
Copy link
Member

dblock commented Jun 26, 2023

@nathanmyles Can't confirm or deny which versions of AWS OpenSearch it will go into and when, but if you do open a customer support ticket they can certainly find out and track it for you.

imRishN pushed a commit to imRishN/OpenSearch that referenced this pull request Jun 27, 2023
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
Signed-off-by: Nathan Myles <myles.n.a@gmail.com>

Issue: opensearch-project#7308
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.x backport 1.3 Backport to 1.3 branch backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mapping char_filter for '# => _hashsign_' not working from version 2.4.0
5 participants