Index two docs:
curl -XPUT 'http://127.0.0.1:9200/test/test/1?pretty=1' -d '
{
"text" : "foo bar"
}
'
curl -XPUT 'http://127.0.0.1:9200/test/test/2?pretty=1' -d '
{
"text" : "baz"
}
'
Check the terms facet:
curl -XGET 'http://127.0.0.1:9200/test/test/_search?pretty=1' -d '
{
"facets" : {
"text" : {
"terms" : {
"all_terms" : 1,
"field" : "text"
}
}
},
"size" : 0
}
'
# {
# "hits" : {
# "hits" : [],
# "max_score" : 1,
# "total" : 2
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "facets" : {
# "text" : {
# "other" : 0,
# "terms" : [
# {
# "count" : 1,
# "term" : "foo"
# },
# {
# "count" : 1,
# "term" : "baz"
# },
# {
# "count" : 1,
# "term" : "bar"
# }
# ],
# "missing" : 0,
# "_type" : "terms",
# "total" : 3
# }
# },
# "took" : 3
# }
Delete one doc:
curl -XDELETE 'http://127.0.0.1:9200/test/test/1?pretty=1'
The terms no longer show up in the terms facet:
curl -XGET 'http://127.0.0.1:9200/test/test/_search?pretty=1' -d '
{
"facets" : {
"text" : {
"terms" : {
"all_terms" : 1,
"field" : "text"
}
}
},
"size" : 0
}
'
# {
# "hits" : {
# "hits" : [],
# "max_score" : 1,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "facets" : {
# "text" : {
# "other" : 0,
# "terms" : [
# {
# "count" : 1,
# "term" : "baz"
# }
# ],
# "missing" : 0,
# "_type" : "terms",
# "total" : 1
# }
# },
# "took" : 1
# }