Created
November 21, 2012 16:16
-
-
Save drewr/4125767 to your computer and use it in GitHub Desktop.
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 -s -X DELETE localhost:9200/test | |
echo | |
echo mapping | |
curl -s -X PUT localhost:9200/test -d ' | |
{ | |
"mappings": { | |
"orte": { | |
"dynamic": false, | |
"properties": { | |
"ort": { | |
"index_analyzer": "edge_ngram_analyzer", | |
"search_analyzer": "default", | |
"store": "yes", | |
"term_vector": "with_positions_offsets", | |
"type": "string" | |
}, | |
"synonyme": { | |
"index_analyzer": "edge_ngram_analyzer", | |
"search_analyzer": "default", | |
"store": "yes", | |
"term_vector": "with_positions_offsets", | |
"type": "string" | |
} | |
} | |
} | |
}, | |
"settings": { | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"default": { | |
"filter": "icu_folding", | |
"tokenizer": "icu_tokenizer", | |
"type": "custom" | |
}, | |
"edge_ngram_analyzer": { | |
"filter": [ | |
"icu_folding", | |
"token_edgeNGram" | |
], | |
"tokenizer": "icu_tokenizer", | |
"type": "custom" | |
}, | |
"token_analyzer": { | |
"filter": [ | |
"icu_folding", | |
"token_nGram" | |
], | |
"tokenizer": "keyword", | |
"type": "custom" | |
}, | |
"token_ngram_search_analyzer": { | |
"filter": [ | |
"icu_folding" | |
], | |
"tokenizer": "keyword", | |
"type": "custom" | |
} | |
}, | |
"filter": { | |
"token_edgeNGram": { | |
"max_gram": 30, | |
"min_gram": 1, | |
"side": "front", | |
"type": "edgeNGram" | |
}, | |
"token_nGram": { | |
"max_gram": 300, | |
"min_gram": 1, | |
"type": "nGram" | |
} | |
} | |
} | |
} | |
} | |
} | |
' | |
echo | |
echo deutsch | |
curl -s -X POST "http://localhost:9200/test/orte?pretty=0" -d '{ | |
"ort": "Deutschland" | |
} | |
' | |
echo | |
echo europa | |
curl -s -X POST "http://localhost:9200/test/orte?pretty=0" -d '{ | |
"ort": "Europa", | |
"synonyme": "Das alte Land" | |
} | |
' | |
echo | |
curl -s -X POST "http://localhost:9200/test/_refresh" | |
echo | |
echo "-----------finds one hit : OK --" | |
curl -s "http://localhost:9200/test/orte/_search?pretty=1" -d ' | |
{ | |
query: { | |
"text": { | |
"synonyme" : "das alte" | |
} | |
} | |
} | |
' | |
echo "-----------does not find a hit : NOT OK --" | |
curl -s "http://localhost:9200/test/orte/_search?pretty=1" -d ' | |
{ | |
query: { | |
"text": { | |
"synonyme" : "das al" | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment