Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Created July 20, 2012 19:42
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 clintongormley/3152797 to your computer and use it in GitHub Desktop.
Save clintongormley/3152797 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"mappings" : {
"path" : {
"_id" : {
"path" : "path"
},
"properties" : {
"path" : {
"index_name" : "filepath",
"index" : "not_analyzed",
"type" : "string"
}
}
}
}
}
'
curl -XPOST 'http://127.0.0.1:9200/test/path?pretty=1' -d '
{
"path" : "foo"
}
'
curl -XGET 'http://127.0.0.1:9200/test/path/_search?pretty=1' -d '
{
"query" : {
"text" : {
"path.path" : "foo"
}
}
}
'
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "path" : "foo"
# },
# "_score" : 0.30685282,
# "_index" : "test",
# "_id" : "foo",
# "_type" : "path"
# }
# ],
# "max_score" : 0.30685282,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 2
# }
curl -XGET 'http://127.0.0.1:9200/test/path/_search?pretty=1' -d '
{
"query" : {
"text" : {
"path" : "foo"
}
}
}
'
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "path" : "foo"
# },
# "_score" : 0.30685282,
# "_index" : "test",
# "_id" : "foo",
# "_type" : "path"
# }
# ],
# "max_score" : 0.30685282,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 1
# }
curl -XGET 'http://127.0.0.1:9200/test/path/_search?pretty=1' -d '
{
"query" : {
"text" : {
"filepath" : "foo"
}
}
}
'
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "path" : "foo"
# },
# "_score" : 0.30685282,
# "_index" : "test",
# "_id" : "foo",
# "_type" : "path"
# }
# ],
# "max_score" : 0.30685282,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 1
# }
curl -XGET 'http://127.0.0.1:9200/test/path/_search?pretty=1' -d '
{
"query" : {
"text" : {
"path.filepath" : "foo"
}
}
}
'
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "path" : "foo"
# },
# "_score" : 0.30685282,
# "_index" : "test",
# "_id" : "foo",
# "_type" : "path"
# }
# ],
# "max_score" : 0.30685282,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 58
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment