{"id":22973660,"url":"https://github.com/pipizhang/docker-elasticsearch-analysis-ik","last_synced_at":"2025-08-03T06:35:14.068Z","repository":{"id":78438047,"uuid":"135848136","full_name":"pipizhang/docker-elasticsearch-analysis-ik","owner":"pipizhang","description":"Docker for Elasticsearch + IK Analysis","archived":false,"fork":false,"pushed_at":"2019-05-04T13:29:23.000Z","size":3,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T00:35:39.447Z","etag":null,"topics":["docker","elasticsearch","ik-analyzer"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pipizhang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-02T19:57:57.000Z","updated_at":"2023-07-19T10:38:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"a25741f0-efa0-4510-adb3-3e03cafec457","html_url":"https://github.com/pipizhang/docker-elasticsearch-analysis-ik","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pipizhang/docker-elasticsearch-analysis-ik","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pipizhang%2Fdocker-elasticsearch-analysis-ik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pipizhang%2Fdocker-elasticsearch-analysis-ik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pipizhang%2Fdocker-elasticsearch-analysis-ik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pipizhang%2Fdocker-elasticsearch-analysis-ik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pipizhang","download_url":"https://codeload.github.com/pipizhang/docker-elasticsearch-analysis-ik/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pipizhang%2Fdocker-elasticsearch-analysis-ik/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259809029,"owners_count":22914754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","elasticsearch","ik-analyzer"],"created_at":"2024-12-14T23:57:47.494Z","updated_at":"2025-06-14T11:33:23.312Z","avatar_url":"https://github.com/pipizhang.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker for Elasticsearch + IK Analysis\n\nThis is the Git repo of the Docker image for Elasticsearch + IK Analysis.\n\n#### Getting started\nA Quick Test\n```bash\ndocker run --rm --name es -p 9200:9200 -p 9300:9300 peterzhang/elasticsearch-analysis-ik\n```\n\nPersist Elasticsearch data\n```bash\ndocker run --rm --name es -p 9200:9200 -p 9300:9300 -v $(pwd)/data:/usr/share/elasticsearch/data peterzhang/elasticsearch-analysis-ik\n```\n\n#### Quick Example\n\n1.create a index\n\n```bash\ncurl -XPUT http://localhost:9200/index\n```\n\n2.create a mapping\n\n```bash\ncurl -XPOST http://localhost:9200/index/fulltext/_mapping -H 'Content-Type:application/json' -d'\n{\n        \"properties\": {\n            \"content\": {\n                \"type\": \"text\",\n                \"analyzer\": \"ik_max_word\",\n                \"search_analyzer\": \"ik_max_word\"\n            }\n        }\n\n}'\n```\n\n3.index some docs\n\n```bash\ncurl -XPOST http://localhost:9200/index/fulltext/1 -H 'Content-Type:application/json' -d'\n{\"content\":\"美国留给伊拉克的是个烂摊子吗\"}\n'\n```\n\n```bash\ncurl -XPOST http://localhost:9200/index/fulltext/2 -H 'Content-Type:application/json' -d'\n{\"content\":\"公安部：各地校车将享最高路权\"}\n'\n```\n\n```bash\ncurl -XPOST http://localhost:9200/index/fulltext/3 -H 'Content-Type:application/json' -d'\n{\"content\":\"中韩渔警冲突调查：韩警平均每天扣1艘中国渔船\"}\n'\n```\n\n```bash\ncurl -XPOST http://localhost:9200/index/fulltext/4 -H 'Content-Type:application/json' -d'\n{\"content\":\"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首\"}\n'\n```\n\n4.query with highlighting\n\n```bash\ncurl -XPOST http://localhost:9200/index/fulltext/_search  -H 'Content-Type:application/json' -d'\n{\n    \"query\" : { \"match\" : { \"content\" : \"中国\" }},\n    \"highlight\" : {\n        \"pre_tags\" : [\"\u003ctag1\u003e\", \"\u003ctag2\u003e\"],\n        \"post_tags\" : [\"\u003c/tag1\u003e\", \"\u003c/tag2\u003e\"],\n        \"fields\" : {\n            \"content\" : {}\n        }\n    }\n}\n'\n```\n\nResult\n\n```json\n{\n    \"took\": 14,\n    \"timed_out\": false,\n    \"_shards\": {\n        \"total\": 5,\n        \"successful\": 5,\n        \"failed\": 0\n    },\n    \"hits\": {\n        \"total\": 2,\n        \"max_score\": 2,\n        \"hits\": [\n            {\n                \"_index\": \"index\",\n                \"_type\": \"fulltext\",\n                \"_id\": \"4\",\n                \"_score\": 2,\n                \"_source\": {\n                    \"content\": \"中国驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首\"\n                },\n                \"highlight\": {\n                    \"content\": [\n                        \"\u003ctag1\u003e中国\u003c/tag1\u003e驻洛杉矶领事馆遭亚裔男子枪击 嫌犯已自首 \"\n                    ]\n                }\n            },\n            {\n                \"_index\": \"index\",\n                \"_type\": \"fulltext\",\n                \"_id\": \"3\",\n                \"_score\": 2,\n                \"_source\": {\n                    \"content\": \"中韩渔警冲突调查：韩警平均每天扣1艘中国渔船\"\n                },\n                \"highlight\": {\n                    \"content\": [\n                        \"均每天扣1艘\u003ctag1\u003e中国\u003c/tag1\u003e渔船 \"\n                    ]\n                }\n            }\n        ]\n    }\n}\n```\n\n#### Troubleshooting\n\n1.virtual memory areas vm.max_map_count [65530] is too low\n\nThe vm.max_map_count setting should be set permanently in /etc/sysctl.conf or /etc/sysctl.d/?.conf:\n\n```bash\n$ grep vm.max_map_count /etc/sysctl.conf\nvm.max_map_count=262144\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpipizhang%2Fdocker-elasticsearch-analysis-ik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpipizhang%2Fdocker-elasticsearch-analysis-ik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpipizhang%2Fdocker-elasticsearch-analysis-ik/lists"}