Created
November 22, 2016 17:21
-
-
Save hectorgool/1b4dacb2fd4095fd778551fd684adf6d to your computer and use it in GitHub Desktop.
query term
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 characters
| package main | |
| /* | |
| { | |
| "query": { | |
| "match": { | |
| "_all": { | |
| "operator": "and", | |
| "query": "Rodolfo Guzman Huerta" | |
| } | |
| } | |
| }, | |
| "size": 10, | |
| "sort": [ | |
| { | |
| "colonia": { | |
| "mode": "avg", | |
| "order": "asc" | |
| } | |
| } | |
| ] | |
| } | |
| */ | |
| import ( | |
| j "github.com/ricardolonga/jsongo" | |
| "fmt" | |
| ) | |
| func main() { | |
| term := "Rodolfo Guzman Huerta" | |
| json := j.Object(). | |
| Put("size", 10). | |
| Put("query", j.Object(). | |
| Put("match", j.Object(). | |
| Put("_all", j.Object(). | |
| Put("query", term). | |
| Put("operator", "and")))). | |
| Put("sort", j.Array(). | |
| Put(j.Object(). | |
| Put("colonia", j.Object(). | |
| Put("order", "asc"). | |
| Put("mode", "avg")))) | |
| fmt.Println(json.Indent()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment