Skip to content

Instantly share code, notes, and snippets.

Created October 17, 2011 15:42
Show Gist options
  • Save anonymous/1292897 to your computer and use it in GitHub Desktop.
Save anonymous/1292897 to your computer and use it in GitHub Desktop.
Script for recreating Issue 1305
use strict; use warnings;
use ElasticSearch;
my $N = 10;
my $es = ElasticSearch->new(transport => 'httptiny', trace_calls => 'ilog');
$es->delete_index( index => 'tsti', ignore_missing => 'true');
$es->create_index(
index => 'tsti',
settings => {
number_of_replicas => 0,
#number_of_shards => 1, #this would fix the problem
},
mappings => {
tsti => {
properties => {
user => { type => 'string', index => 'not_analyzed'},
}
}
},
);
for my $i (1..$N) {
$es->index(
index => 'tsti',
type => 'tsti',
data => {user => "user $i" }
) for (1..$i);
}
sleep 10;
for (1..$N) {
$es->search(
index => 'tsti',
size => 0,
search_type => 'count',
queryb => {
-all => {},
},
facets => {
ffacet => {
terms => {
field => 'user',
size => $_,
}
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment