Last active
July 30, 2019 17:19
-
-
Save matthuhiggins/16b5d29c2ea0bb4a9e21f64268b6865f to your computer and use it in GitHub Desktop.
Multiple tokens in a synonym analyzer within a multiplexer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X DELETE "localhost:9200/companies" | |
curl -X PUT "localhost:9200/companies" -H 'Content-Type: application/json' -d' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"company_name_analyzer": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": ["company_name_filter"] | |
} | |
}, | |
"filter": { | |
"company_name_filter": { | |
"type": "multiplexer", | |
"filters": ["company_name_abbreviations"] | |
}, | |
"company_name_abbreviations": { | |
"type": "synonym", | |
"synonyms": ["co-op => cooperative", "corp => corporation"] | |
} | |
} | |
} | |
} | |
}' | |
# This will not work. Returns ["co op"] | |
curl -X GET "localhost:9200/companies/_analyze" -H 'Content-Type: application/json' -d' | |
{ | |
"analyzer": "company_name_analyzer", | |
"text": "co-op" | |
}' | |
# This will work. Returns ["corporation"] | |
curl -X GET "localhost:9200/companies/_analyze" -H 'Content-Type: application/json' -d' | |
{ | |
"analyzer": "company_name_analyzer", | |
"text": "corp" | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apologies for bringing this up again. The nuanced problem above is blocking an ES 7 upgrade. I am unsure what you meant by the graph filter not handling incoming graphs, as my problem is exposing what this warning describes:
Is this the same problem as not supporting an incoming graph?
Currently, my best option is to pre-process the text in my code.