Skip to content

Instantly share code, notes, and snippets.

@luizgpsantos
Last active August 29, 2015 14:17
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 luizgpsantos/46165f10cfdecfc6aa4f to your computer and use it in GitHub Desktop.
Save luizgpsantos/46165f10cfdecfc6aa4f to your computer and use it in GitHub Desktop.
Cores
curl -XPOST "http://localhost:9200/index_name" -d'
{
"mappings": {
"your_type": {
"properties": {
"colours": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}'
curl -XPOST "http://localhost:9200/index_name/your_type/person1" -d'
{
"name": "ben",
"age": 30,
"colours": ["azul", "amarelo", "preto"]
}'
curl -XPOST "http://localhost:9200/index_name/your_type/person2" -d'
{
"name": "linda",
"age": 10,
"colours": ["preto", "branco", "verde"]
}'
curl -XPOST "http://localhost:9200/index_name/your_type/person3" -d'
{
"name": "clark",
"age": 22,
"colours": ["azul", "amarelo-torrado", "verde"]
}'
curl -XPOST "http://localhost:9200/index_name/your_type/person4" -d'
{
"name": "jerry",
"age": 20,
"colours": ["laranja", "amarelo", "branco"]
}'
curl -XPOST "http://localhost:9200/index_name/your_type/_search" -d'
{
"query": {
"bool": {
"should": [
{
"match": {
"colours": "azul"
}
},
{
"match": {
"colours": "amarelo"
}
},
{
"match": {
"colours": "rosa"
}
}
]
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment