Skip to content

Instantly share code, notes, and snippets.

@EgorLakomkin
Last active November 6, 2015 09:44
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 EgorLakomkin/b72d68410e0682243cea to your computer and use it in GitHub Desktop.
Save EgorLakomkin/b72d68410e0682243cea to your computer and use it in GitHub Desktop.
curl -XDELETE "http://localhost:9200/test_es_index" && echo
curl -XPUT "http://localhost:9200/test_es_index" -d ' {
"settings" : {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis" : {
"filter" : {
"stop_filter" : {
"type" : "stop",
"stopwords" : [ "a", "that", "those" ]
}
},
"analyzer" : {
"content_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "stop_filter"]
}
}
}
},
"mappings" : {
"doc" : {
"properties":{
"content" : { "type" : "multi_field",
"fields":{
"original" : {"type" : "string", "analyzer" : "content_analyzer"}
}
}
}
}
}
}' && echo
curl -XPOST 'http://localhost:9200/test_es_index/doc' -d '{
"content" : "three four world that awesome those hello five"
}' && echo
curl -XPOST "http://localhost:9200/test_es_index/_refresh" && echo
curl -s "http://localhost:9200/test_es_index/_search?pretty=true" -d '
{"query": {
"query_string" : {
"default_field" : "content.original",
"query" : "hello world",
"default_operator" : "and",
"enable_position_increments": "false",
"phrase_slop" : 0
}
},
"highlight" : {"require_field_match" : "true", "fields" : {"content.original" : {} } }
}' && echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment