Skip to content

Instantly share code, notes, and snippets.

View macohen's full-sized avatar

Mark Cohen macohen

  • Amazon Web Services
  • Ridgewood, NJ
  • 12:23 (UTC -04:00)
  • X @markcohenn
View GitHub Profile
@macohen
macohen / test_plugins_client.py
Created January 19, 2024 22:53
dunder method pylint
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
@macohen
macohen / disable_pylint_check.py
Created January 11, 2024 15:51
Script to add disable lint instructions for every method in a package/directory
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
import os
import re
@macohen
macohen / conftest.py
Created January 9, 2024 15:42
My Py Mess
"""
"""
nox > mypy --strict setup.py noxfile.py opensearchpy/ test_opensearchpy/ utils/ samples/ benchmarks/ docs/
test_opensearchpy/test_server/test_helpers/conftest.py:65: error: Item "None" of "Optional[Match[str]]" has no attribute "group" [union-attr]
test_opensearchpy/test_async/test_server/test_helpers/conftest.py:52: error: Item "None" of "Optional[Match[str]]" has no attribute "group" [union-attr]
"""
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
@macohen
macohen / gist:9f335a741677fac2e916cf980f8019fe
Last active September 14, 2023 16:41
Token Filters Needing Documentation in OpenSearch
public class PhoneticTokenFilterFactory extends AbstractTokenFilterFactory {
./plugins/analysis-phonetic/src/main/java/org/opensearch/index/analysis/PhoneticTokenFilterFactory.java
public class NoriReadingFormFilterFactory extends AbstractTokenFilterFactory {
./plugins/analysis-nori/src/main/java/org/opensearch/index/analysis/NoriReadingFormFilterFactory.java
public class NoriPartOfSpeechStopFilterFactory extends AbstractTokenFilterFactory {
./plugins/analysis-nori/src/main/java/org/opensearch/index/analysis/NoriPartOfSpeechStopFilterFactory.java
public class NoriNumberFilterFactory extends AbstractTokenFilterFactory {
./plugins/analysis-nori/src/main/java/org/opensearch/index/analysis/NoriNumberFilterFactory.java
public class KuromojiKatakanaStemmerFactory extends AbstractTokenFilterFactory {
./plugins/analysis-kuromoji/src/main/java/org/opensearch/index/analysis/KuromojiKatakanaStemmerFactory.java
@macohen
macohen / gist:98fb9d40c23242fea334be1d045e0f4c
Created September 7, 2023 14:22
Failing LTR Build on 2.7.1
On branch 2.7
Your branch is up to date with 'upstream/2.7'.
nothing to commit, working tree clean
% ./gradlew -Dopensearch.version=2.7.1 projects
> Configure project :opensearch-learning-to-rank-base
opensearch_version 2.7.1-SNAPSHOT
plugin_version 2.7.1.0-SNAPSHOT
Skipping Integ Tests
@macohen
macohen / plugin-distro.md
Last active October 25, 2022 15:15
OpenSearch: How Can We Determine if a Plugin Should Be in the Distribution?
  • Pros and cons of being in the distribution, in general.
    • Pros
      • No installation needed by the user. Just enable and go...
      • Certified and approved by the OpenSearch organization
    • Cons
      • Must abide by the rules of OpenSearch including CICD process, security requirements
      • Not every use case may require the plugin
  • Pros and cons of NOT being in the distribution
{
"comparison": {
"query": "When was Anthony Hopkins born?",
"configurations: [
{
"name": "my_search_configuration",
"dsl": "<query>"
},
{
"name": "my_other_search_configuration",