Skip to content

Instantly share code, notes, and snippets.

@erickt
Created December 16, 2011 20:46
Show Gist options
  • Select an option

  • Save erickt/1487899 to your computer and use it in GitHub Desktop.

Select an option

Save erickt/1487899 to your computer and use it in GitHub Desktop.
% curl -XDELETE http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/test/_mapping \
-d {"test":{"properties":{"bar":{"type":"string","index":"not_analyzed"}}}}
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/test/1?refresh=true -d {"foo":"1", "bar":"a"}
{"ok":true,"_index":"test","_type":"test","_id":"1","_version":1}
% curl -XPUT http://localhost:9200/test/test/1?refresh=true -d {"foo":"1", "bar":"bc"}
{"ok":true,"_index":"test","_type":"test","_id":"1","_version":2}
% curl -XGET http://localhost:9200/test/test/_mapping
{"test":{"properties":{"foo":{"type":"string"},"bar":{"index":"not_analyzed","type":"string"}}}}
% curl -XGET http://localhost:9200/test/_analyze?field=test.bar -d a
{"tokens":[{"token":"a","start_offset":0,"end_offset":1,"type":"word","position":1}]}
% curl -XGET http://localhost:9200/test/test/_search?pretty=true -d {"query":{"term":{"bar":"a"}}}
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"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