Skip to content

Instantly share code, notes, and snippets.

@ba9els
Created March 24, 2016 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ba9els/262509c3a113d59df964 to your computer and use it in GitHub Desktop.
Save ba9els/262509c3a113d59df964 to your computer and use it in GitHub Desktop.
A batch of curl commands that are used to create a index and indexing 3 sample documents
# Create index
curl -XPUT 'localhost:9200/bosonnlp_test'
# Create mapping
curl -XPUT 'localhost:9200/bosonnlp_test/text/_mapping?ignore_conflicts=true' -d '{
"text":{
"properties": {
"content": {
"type": "string",
"term_vector": "with_positions_offsets",
"analyzer": "bosonnlp",
"search_analyzer": "bosonnlp"
}
}
}
}'
# Index documents
curl -XPUT 'localhost:9200/bosonnlp_test/text/1?pretty' -d '{
"content": "美称中国武器商很神秘 花巨资海外参展却一言不发"
}'
curl -XPUT 'localhost:9200/bosonnlp_test/text/2?pretty' -d '{
"content": "在第一界国际锦标赛中 国家代表李雷勇夺冠军"
}'
curl -XPUT 'localhost:9200/bosonnlp_test/text/3?pretty' -d '{
"content": "国武公司近日上市"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment