Last active
January 8, 2021 13:23
-
-
Save ianribas/f76d20c21bb9f5c0df2f to your computer and use it in GitHub Desktop.
Revisions
-
ianribas revised this gist
Apr 2, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,8 +46,8 @@ curl -XPUT 'http://localhost:9200/multiwordsyns/test/2?pretty' -d '{"text": "wha curl -XPUT 'http://localhost:9200/multiwordsyns/test/3?pretty' -d '{"text": "that spider is the size of a man"}' curl -XPUT 'http://localhost:9200/multiwordsyns/test/4?pretty&refresh=true' -d '{"text": "spiders eat insects"}' # WRONG! finds only #1, should find #1 & #3 curl -XPOST 'http://localhost:9200/multiwordsyns/test/_search?pretty' -d '{"query": {"match": {"text": {"query": "spiderman", "operator": "and"}}}}' # Also WRONG! finds only #1, should find #1 & #3 curl -XPOST 'http://localhost:9200/multiwordsyns/test/_search?pretty' -d '{"query": {"match": {"text": {"query": "spider man", "operator": "and"}}}}' -
ianribas revised this gist
Dec 16, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,8 +46,8 @@ curl -XPUT 'http://localhost:9200/multiwordsyns/test/2?pretty' -d '{"text": "wha curl -XPUT 'http://localhost:9200/multiwordsyns/test/3?pretty' -d '{"text": "that spider is the size of a man"}' curl -XPUT 'http://localhost:9200/multiwordsyns/test/4?pretty&refresh=true' -d '{"text": "spiders eat insects"}' # WRONG! should find #1 & #3 curl -XPOST 'http://localhost:9200/multiwordsyns/test/_search?pretty' -d '{"query": {"match": {"text": {"query": "spiderman", "operator": "and"}}}}' # Also WRONG! should find #1 & #3 curl -XPOST 'http://localhost:9200/multiwordsyns/test/_search?pretty' -d '{"query": {"match": {"text": {"query": "spider man", "operator": "and"}}}}' -
ianribas created this gist
Aug 14, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ #!/bin/bash # delete old index if exists curl -XDELETE 'http://localhost:9200/multiwordsyns?pretty' # create index with synonym analyzer and mapping curl -XPUT 'http://localhost:9200/multiwordsyns?pretty' -d '{ "settings" : { "number_of_replicas": 0, "number_of_shards": 1, "index": { "analysis": { "analyzer": { "index_time": { "tokenizer": "standard", "filter": ["standard", "lowercase"] }, "synonym": { "tokenizer": "standard", "filter": ["standard", "lowercase", "stop", "synonym"] } }, "filter": { "synonym": { "type": "synonym", "synonyms": [ "spider man, spiderman" ] } } } } }, "mappings": { "test": { "properties": { "text": {"type": "string", "index_analyzer": "index_time", "search_analyzer": "synonym"} } } } }' # index the test documents curl -XPUT 'http://localhost:9200/multiwordsyns/test/1?pretty' -d '{"text": "the adventures of spiderman"}' curl -XPUT 'http://localhost:9200/multiwordsyns/test/2?pretty' -d '{"text": "what hath man wrought?"}' curl -XPUT 'http://localhost:9200/multiwordsyns/test/3?pretty' -d '{"text": "that spider is the size of a man"}' curl -XPUT 'http://localhost:9200/multiwordsyns/test/4?pretty&refresh=true' -d '{"text": "spiders eat insects"}' # WRONG! should find #1 & #4 curl -XPOST 'http://localhost:9200/multiwordsyns/test/_search?pretty' -d '{"query": {"match": {"text": {"query": "spiderman", "operator": "and"}}}}' # Also WRONG! should find #1 & #4 curl -XPOST 'http://localhost:9200/multiwordsyns/test/_search?pretty' -d '{"query": {"match": {"text": {"query": "spider man", "operator": "and"}}}}'