Skip to content

Instantly share code, notes, and snippets.

@martijnvg
Created September 11, 2012 16:18
Show Gist options
  • Save martijnvg/3699628 to your computer and use it in GitHub Desktop.
Save martijnvg/3699628 to your computer and use it in GitHub Desktop.
curl -XDELETE "http://localhost:9200/test_index"
curl -XPUT "http://localhost:9200/test_index/"
curl -XPUT "http://localhost:9200/test_index/test_index/_mapping" -d '{
"test_index" : {
"_source" : {"enabled" : true},
"properties": {
"A": { "include_in_all": true, "type": "string"},
"B": { "include_in_all": false, "type": "string"}
}
}
}'
curl -XPUT 'http://localhost:9200/test_index/test_index/1' -d '{
"A": "abc cde zzz",
"B": "xxx zzz"
}'
curl 'http://localhost:9200/test_index/_refresh'
curl -XGET 'http://localhost:9200/test_index/test_index/_search' -d '{
"query": {
"bool" : {
"must" :[{
"queryString" : {
"query": "abc",
"fields" : ["_all", "A"]
}
},{
"queryString" : {
"query": "zzz",
"default_field": "B"
}
}
]
}
},
"highlight": {
"fields": {
"A": {}
},
"require_field_match": true
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment