Skip to content

Instantly share code, notes, and snippets.

@mauricioalarcon
Created November 22, 2012 16:36
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 mauricioalarcon/4132033 to your computer and use it in GitHub Desktop.
Save mauricioalarcon/4132033 to your computer and use it in GitHub Desktop.
simple text search
# Inserting a pckg
curl -X POST localhost:9200/pckgs/pckg/1 -d '{
"pckg" : {
"title" : "Rio de Janeiro",
"shuttleService": "NOTINC",
"published" : "true",
}
}'
# Checking it's there
curl -X GET localhost:9200/pckgs/_search?pretty=true
# Search by shuttleService = NOTINC
curl -X GET localhost:9200/pckgs/_search?pretty=true -d '{
"query": {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : { "shuttleService" : "NOTINC" }
}
}
}
}'
# my other attempt
curl -X GET localhost:9200/pckgs/_search?pretty=true -d '{
"query" : {
"term" : {"shuttleService" : "NOTINC"}
}
}'
# response for both searches below
#
# "hits" : {
# "total" : 0,
# "max_score" : null,
# "hits" : [ ]
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment