Last active
          August 29, 2015 14:17 
        
      - 
      
 - 
        
Save luizgpsantos/46165f10cfdecfc6aa4f to your computer and use it in GitHub Desktop.  
Revisions
- 
        
luizgpsantos revised this gist
Mar 26, 2015 . 2 changed files with 15 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,17 @@ 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", @@ -16,7 +30,7 @@ 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' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,3 @@ curl -XPOST "http://localhost:9200/index_name/your_type/_search" -d' { "query": {  - 
        
luizgpsantos created this gist
Mar 26, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ 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", "marron", "verde"] }' curl -XPOST "http://localhost:9200/index_name/your_type/person4" -d' { "name": "jerry", "age": 20, "colours": ["laranja", "amarelo", "branco"] }' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ # Maneira mais simples: curl -XPOST "http://localhost:9200/index_name/your_type/_search" -d' { "query": { "match": { "colours": "azul amarelo rosa" } } }' # Ou se você quiser mais explícito: curl -XPOST "http://localhost:9200/index_name/your_type/_search" -d' { "query": { "bool": { "should": [ { "match": { "colours": "azul" } }, { "match": { "colours": "amarelo" } }, { "match": { "colours": "rosa" } } ] } } }'