本文整理汇总了Java中org.elasticsearch.common.collect.Iterables类的典型用法代码示例。如果您正苦于以下问题:Java Iterables类的具体用法?Java Iterables怎么用?Java Iterables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Iterables类属于org.elasticsearch.common.collect包,在下文中一共展示了Iterables类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: index
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
/**
* Add the record to the index.
*/
@Override
public void index(Record record) {
if (this.client == null) {
this.init();
}
String id = null;
Map<String, Object> json = new HashMap<String, Object>();
for (String propname : record.getProperties()) {
Property prop = config.getPropertyByName(propname);
if (prop == null) {
throw new DukeConfigException("Record has property " + propname
+ " for which there is no configuration");
}
if (prop.isIdProperty()) {
id = record.getValue(propname);
} else {
Collection<String> values = record.getValues(propname);
if (values != null && !values.isEmpty()) {
if (values.size() == 1) {
json.put(propname, Iterables.get(values, 0));
} else {
json.put(propname, values);
}
}
}
}
this.addToIndex(id, json);
}
开发者ID:enricopal,项目名称:STEM,代码行数:38,代码来源:ElasticSearchDatabase.java
示例2: ensureValidKeyNames
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private void ensureValidKeyNames()
{
assertThat(Iterables.any(statsdMockServer.content, containsPattern("\\.\\.")), is(false));
assertThat(Iterables.any(statsdMockServer.content, containsPattern("\\[")), is(false));
assertThat(Iterables.any(statsdMockServer.content, containsPattern("\\]")), is(false));
assertThat(Iterables.any(statsdMockServer.content, containsPattern("\\(")), is(false));
assertThat(Iterables.any(statsdMockServer.content, containsPattern("\\)")), is(false));
}
开发者ID:swoop-inc,项目名称:elasticsearch-statsd-plugin,代码行数:9,代码来源:StatsdPluginIntegrationTest.java
示例3: getAllStashProjectKeys
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private Iterable<String> getAllStashProjectKeys() {
String url = baseUrl + "/projects" + "?" + ALL;
String response = stashRestClient.performGetRequest(url);
List<StashProject> projects = parser.extractStashProjects(response);
return Iterables.transform(projects, new Function<StashProject, String>() {
@Override
public String apply(StashProject stashProject) {
return stashProject.getKey();
}
});
}
开发者ID:raymyers,项目名称:dev-search,代码行数:12,代码来源:Stash.java
示例4: ensureValidKeyNames
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private void ensureValidKeyNames() {
assertThat(Iterables.any(graphiteMockServer.content, containsPattern("\\.\\.")), is(false));
assertThat(Iterables.any(graphiteMockServer.content, containsPattern("\\[")), is(false));
assertThat(Iterables.any(graphiteMockServer.content, containsPattern("\\]")), is(false));
assertThat(Iterables.any(graphiteMockServer.content, containsPattern("\\(")), is(false));
assertThat(Iterables.any(graphiteMockServer.content, containsPattern("\\)")), is(false));
}
开发者ID:spinscale,项目名称:elasticsearch-graphite-plugin,代码行数:8,代码来源:GraphitePluginIntegrationTest.java
示例5: init
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private void init() {
this.setupConnection();
// Create index if it does not already exist
IndicesExistsResponse response = client.admin().indices()
.exists(new IndicesExistsRequest(indexName)).actionGet();
boolean forceCreate = false;
if (response.isExists() && !this.overwrite) {
client.admin().indices().prepareDelete(this.indexName).execute()
.actionGet();
forceCreate = true;
}
if (!response.isExists() || forceCreate) {
CreateIndexResponse create = client.admin().indices()
.prepareCreate(indexName).execute().actionGet();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(
"Interrupted while waiting for index to settle in", e);
}
if (!create.isAcknowledged()) {
throw new IllegalArgumentException("Could not create index: "
+ indexName);
}
// create mapping
// XContentBuilder builder = null;
// try {
// builder =
// XContentFactory.jsonBuilder().startObject().startObject(this.indexType).startObject("properties");
// for (Property p : config.getProperties()) {
// if (!p.isIdProperty()) {
// // TODO: experiment similarity OKAPY BM25 for short
// // fields
// //
// (http://info.elasticsearch.com/rs/elasticsearch/images/What's%20new%20in%200.90%205-3-12.pdf)
// builder.startObject(p.getName()).field("type",
// "string").field("store", "yes").field("index", "analyzed")
// .endObject();
// }
// }
// builder.endObject().endObject().endObject();
// } catch (IOException e) {
// e.printStackTrace();
// }
// PutMappingResponse pmrb =
// client.admin().indices().preparePutMapping(this.indexName).setType(this.indexType).setSource(builder)
// .execute().actionGet();
}
// find id property
Collection<Property> identityProperties = this.config
.getIdentityProperties();
if (identityProperties == null || identityProperties.size() != 1) {
throw new java.lang.IllegalStateException(
"Unable to handle entities without single id");
}
this.idProperty = Iterables.get(identityProperties, 0);
// disable index refresh interval to improve indexing performance
// this is enabled back in commit()
ImmutableSettings.Builder indexSettings = ImmutableSettings
.settingsBuilder();
indexSettings.put("refresh_interval", -1);
this.client.admin().indices().prepareUpdateSettings(this.indexName)
.setSettings(indexSettings).execute().actionGet();
this.bulkRequest = this.client.prepareBulk();
}
开发者ID:enricopal,项目名称:STEM,代码行数:75,代码来源:ElasticSearchDatabase.java
示例6: assertStatsdMetricIsContained
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private void assertStatsdMetricIsContained(final String id)
{
assertThat(Iterables.any(statsdMockServer.content, containsPattern(id)), is(true));
}
开发者ID:swoop-inc,项目名称:elasticsearch-statsd-plugin,代码行数:5,代码来源:StatsdPluginIntegrationTest.java
示例7: assertGraphiteMetricIsContained
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private void assertGraphiteMetricIsContained(final String id) {
assertThat(Iterables.any(graphiteMockServer.content, containsPattern(id)), is(true));
}
开发者ID:spinscale,项目名称:elasticsearch-graphite-plugin,代码行数:4,代码来源:GraphitePluginIntegrationTest.java
示例8: assertGraphiteMetricIsNotContained
import org.elasticsearch.common.collect.Iterables; //导入依赖的package包/类
private void assertGraphiteMetricIsNotContained(final String id) {
assertThat(Iterables.any(graphiteMockServer.content, containsPattern(id)), is(false));
}
开发者ID:spinscale,项目名称:elasticsearch-graphite-plugin,代码行数:4,代码来源:GraphitePluginIntegrationTest.java
注:本文中的org.elasticsearch.common.collect.Iterables类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论