Last active
June 20, 2020 09:48
-
-
Save katzefudder/ebd70b7d6e7cd1aa9dfa5ab1daed99c1 to your computer and use it in GitHub Desktop.
Elasticsearch with images and fuzzy search
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
docker run --rm -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.8.0 |
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
{ | |
"id": 1, | |
"name" : "20200516_Fanclub_RT_001", | |
"date": "20200301", | |
"headline" : "Hier steht eine Headline", | |
"description" : "Fanclub Rote Teufel, v.l. Steffen Leitner, Andrea-Nikolaus-Schnarr, Peter Weber, Franzisco Lucio Tippmann, Bad Nauheim, Colonel-Knight-Stadion, 01.03.20", | |
"imgsrc" : "/app/images/gallery/20200516_Fanclub_RT_001.jpg", | |
"thumb_small" : "/app/images/thumbs_min/20200516_Fanclub_RT_001.jpg", | |
"thumb_medium" : "/app/images/thumbs_med/20200516_Fanclub_RT_001.jpg", | |
"thumb_maximum" : "/app/images/thumbs_max/20200516_Fanclub_RT_001.jpg", | |
"keywords": [ | |
"19/20", | |
"2019/20", | |
"CKS", | |
"Colonel-Knight-Stadion", | |
"DEL 2", | |
"DEL2", | |
"EC Bad Nauheim", | |
"Eishockey", | |
"Eissport", | |
"Fanpakete", | |
"Hockey", | |
"Kurstadt", | |
"Mannschaft", | |
"Rote Teufel", | |
"Sason 2019/2020", | |
"Stadion", | |
"T-Shirt Aktion", | |
"Team", | |
"Wetterau", | |
"Winter", | |
"Wintersport", | |
"icehockey" | |
], | |
"PhotoSource": "https://example.com" | |
} |
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 --request PUT \ | |
--url http://localhost:9200/gallery \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"mappings": { | |
"properties": { | |
"name": { "type": "text" }, | |
"date": { "type": "integer" }, | |
"headline": { "type": "text" }, | |
"description": { "type": "text" }, | |
"imgsrc": { "type": "text" }, | |
"thumbs_small": { "type": "text" }, | |
"thumbs_medium": { "type": "text" }, | |
"thumbs_maximum": { "type": "text" }, | |
"keywords": {"type": "keyword"} | |
} | |
} | |
}' |
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 --request GET \ | |
--url http://localhost:9200/gallery/_search \ | |
--header 'content-type: application/json' \ | |
--cookie JSESSIONID=C2D8AB89D25465895331BC1CEDE2AAD6 \ | |
--data '{ | |
"query": { | |
"multi_match" : { | |
"query" : "Weber", | |
"fields": ["headline", "description"], | |
"fuzziness": "AUTO" | |
} | |
}, | |
"_source": ["headline", "description"], | |
"size": 1 | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment