-
-
Save hxuanji/8e58c0ffb391ced49439 to your computer and use it in GitHub Desktop.
same token position issue
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
echo -e "delete index..." | |
curl -XDELETE "http://192.168.72.24:5028/test" | |
echo -e "\ncreate index..." | |
curl -XPUT "http://192.168.72.24:5028/test" -d ' | |
{ | |
"settings": { | |
"index": { | |
"number_of_shards": 5, | |
"number_of_replicas": 0, | |
"analysis": { | |
"analyzer": { | |
"fielda_index": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ "words_delimiter"] | |
}, | |
"fielda_search": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": ["dot_delimiter"] | |
} | |
}, | |
"filter": { | |
"dot_delimiter": | |
{ | |
"type" : "pattern_capture", | |
"preserve_original" : 1, | |
"patterns" : [ | |
"([\\p{Ll}\\p{Lu}]+\\d*|\\d+)" | |
] | |
}, | |
"words_delimiter": | |
{ | |
"type" : "pattern_capture", | |
"preserve_original" : 1, | |
"patterns" : [ | |
"(\\p{Ll}+|\\p{Lt}+|\\p{Lu}+\\p{Ll}+|\\p{Lu}+)", | |
"(\\d+)" | |
] | |
} | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"main": { | |
"_source": {"enabled": true}, | |
"dynamic_date_formats": ["basic_date_time_no_millis"], | |
"properties": { | |
"name": { "type": "string", "index": "analyzed", "index_analyzer": "fielda_index", "search_analyzer": "fielda_search", "include_in_all": true} | |
} | |
} | |
} | |
} | |
' | |
echo -e "\npush doc..." | |
curl -XPOST "http://192.168.72.24:5028/test/main" -d '{"name": "942430__n.jpg"}' | |
curl -XPOST "http://192.168.72.24:5028/test/main" -d '{"name": "n"}' | |
echo -e "\nsearch..." | |
sleep 2 | |
curl -XPOST "http://192.168.72.24:5028/test/main/_search" -d '{"from": 0, "size": 100, "query":{"match": {"name":{"query":"942430__n.jpg", "operator" : "and"}}}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment