Skip to content

Instantly share code, notes, and snippets.

@matthuhiggins
Created November 15, 2017 16:32
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 matthuhiggins/cc9120845aa2b4307e63f89fc303b972 to your computer and use it in GitHub Desktop.
Save matthuhiggins/cc9120845aa2b4307e63f89fc303b972 to your computer and use it in GitHub Desktop.
curl -XDELETE 'localhost:9200/my-index?pretty'
curl -XPUT 'localhost:9200/my-index?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"doc": {
"properties": {
"message": {
"type": "text"
},
"query": {
"type": "percolator"
}
}
}
}
}
'
curl -XPUT 'localhost:9200/my-index/doc/1?refresh&pretty' -d '
{
"query" : {
"bool": {
"must": [
{
"match" : {
"message" : "Holiday"
}
},
{
"match" : {
"message" : "Inn"
}
},
{
"match" : {
"message" : "Express"
}
}
]
}
}
}
'
curl -XPUT 'localhost:9200/my-index/doc/2?refresh&pretty' -d '
{
"query" : {
"bool": {
"must": [
{
"match" : {
"message" : "Holiday"
}
},
{
"match" : {
"message" : "Inn"
}
}
]
}
}
}
'
curl -XGET 'localhost:9200/my-index/_search?pretty' -d'
{
"query" : {
"percolate" : {
"field" : "query",
"document_type": "doc",
"document" : {
"message" : "Holiday Inn Express & Suites"
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment