Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created February 20, 2012 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save clintongormley/1868139 to your computer and use it in GitHub Desktop.
Save clintongormley/1868139 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1' -d '
{
"mappings" : {
"person" : {
"properties" : {
"name" : {
"omit_norms" : true,
"type" : "string"
}
}
}
}
}
'
curl -XPUT 'http://127.0.0.1:9200/foo/person/1?pretty=1' -d '
{
"name" : [
"David Bowie",
"David Robert Jones",
"Ziggy Stardust",
"Thin White Duke"
]
}
'
curl -XPUT 'http://127.0.0.1:9200/foo/person/2?pretty=1' -d '
{
"name" : [
"David Letterman"
]
}
'
curl -XPUT 'http://127.0.0.1:9200/foo/person/3?pretty=1' -d '
{
"name" : [
"David Hasselhoff",
"David Michael Hasselhoff"
]
}
'
curl -XPOST 'http://127.0.0.1:9200/foo/_refresh?pretty=1'
curl -XGET 'http://127.0.0.1:9200/foo/person/_search?pretty=1' -d '
{
"query" : {
"text" : {
"name" : "david"
}
}
}
'
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "name" : [
# "David Bowie",
# "David Robert Jones",
# "Ziggy Stardust",
# "Thin White Duke"
# ]
# },
# "_score" : 0.4339554,
# "_index" : "foo",
# "_id" : "1",
# "_type" : "person"
# },
# {
# "_source" : {
# "name" : [
# "David Hasselhoff",
# "David Michael Hasselhoff"
# ]
# },
# "_score" : 0.4339554,
# "_index" : "foo",
# "_id" : "3",
# "_type" : "person"
# },
# {
# "_source" : {
# "name" : [
# "David Letterman"
# ]
# },
# "_score" : 0.30685282,
# "_index" : "foo",
# "_id" : "2",
# "_type" : "person"
# }
# ],
# "max_score" : 0.4339554,
# "total" : 3
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 3
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment