Skip to content

Instantly share code, notes, and snippets.

{
"person" : {
"properties" : {
"title" : {
"fields" : {
"title" : {
"type" : "string",
"analyzer" : "standard"
},
"common" : {
@s1monw
s1monw / gist:3868238
Created October 10, 2012 20:32
readfloor
/**
* Enumerates all paths in the automaton that also intersect the FST,
* accumulating the FST end node and output for each path.
*/
public static <T> List<Path<T>> intersectPrefixPaths(Automaton a, FST<T> fst,
final boolean supportRanges) throws IOException {
final List<Path<T>> queue = new ArrayList<Path<T>>();
final List<Path<T>> endNodes = new ArrayList<Path<T>>();
queue.add(new Path<T>(a.getInitialState(), fst
.getFirstArc(new FST.Arc<T>()), fst.outputs.getNoOutput(),
static ConcurrentHashMap<Object, CloseableThreadLocal<TermsEnum>> enums = new ConcurrentHashMap<Object, CloseableThreadLocal<TermsEnum>>();
static CloseableThreadLocal<DocsAndPositionsEnum> docsAndPos = new CloseableThreadLocal<DocsAndPositionsEnum>();
// this works fine for nested docs since they don't have the payload which has the version
// so we iterate till we find the one with the payload
// LUCENE 4 UPGRADE: We can get rid of the do while loop, since there is only one _uid value (live docs are taken into account)
public static DocIdAndVersion loadDocIdAndVersion(AtomicReaderContext context, Term term) {
int docId = Lucene.NO_DOC;
try {
AtomicReader reader = context.reader();
@s1monw
s1monw / ByteValuesComparator.java
Created February 7, 2013 15:59
Minimal invasive example
/*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@s1monw
s1monw / gist:5049626
Created February 27, 2013 17:09
OOM #1
[2013-02-27 17:53:43,619][INFO ][test ] ==> Test Success [integration.recovery.RelocationTests#testPrimaryRelocationWhileBulkIndexingWith10RelocationAnd1Writer]
[2013-02-27 17:53:43,619][INFO ][node ] [node1] {0.21.0.Beta1-SNAPSHOT}[30362]: stopping ...
[2013-02-27 17:53:43,659][INFO ][node ] [node1] {0.21.0.Beta1-SNAPSHOT}[30362]: stopped
[2013-02-27 17:53:43,659][INFO ][node ] [node1] {0.21.0.Beta1-SNAPSHOT}[30362]: closing ...
[2013-02-27 17:53:43,659][INFO ][cluster.service ] [node2] master {new [node2][190][local[226]]{local=true}, previous [node1][189][local[225]]{local=true}}, removed {[node1][189][local[225]]{local=true},}, reason: local-disco-update
[2013-02-27 17:53:43,661][INFO ][node ] [node1] {0.21.0.Beta1-SNAPSHOT}[30362]: closed
[2013-02-27 17:53:43,661][INFO ][node ] [node2] {0.21.0.Beta1-SNAPSHOT}[30362]: stopping ...
[2013-02-27 17:53:43,673][INFO ][node
/*
* Licensed to ElasticSearch and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. ElasticSearch licenses this
* file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@s1monw
s1monw / gist:6041808
Created July 19, 2013 19:35
output example
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 sec - in org.elasticsearch.test.unit.cluster.routing.allocation.SingleShardNoReplicasRoutingTests
testSingleIndexStartedShard(org.elasticsearch.test.unit.cluster.routing.allocation.SingleShardNoReplicasRoutingTests) Time elapsed: 0.001 sec
testSingleIndexShardFailed(org.elasticsearch.test.unit.cluster.routing.allocation.SingleShardNoReplicasRoutingTests) Time elapsed: 0.001 sec
testMultiIndexEvenDistribution(org.elasticsearch.test.unit.cluster.routing.allocation.SingleShardNoReplicasRoutingTests) Time elapsed: 0.013 sec
testMultiIndexUnevenNodes(org.elasticsearch.test.unit.cluster.routing.allocation.SingleShardNoReplicasRoutingTests) Time elapsed: 0.002 sec
Running org.elasticsearch.test.integration.nodesinfo.SimpleNodesInfoTests
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.312 sec - in org.elasticsearch.test.integration.nodesinfo.SimpleNodesInfoTests
testNodeInfoPlugin(org.elasticsearch.test.integration.nodesinfo.S
curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_shards" : 1,
"number_of_replicas" : 1
}
},
"mappings" : {
"participants" : {
import com.google.common.util.concurrent.Futures;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.test.AbstractIntegrationTest;
diff --git a/src/main/java/org/elasticsearch/action/terms/ShardTermsByQueryRequest.java b/src/main/java/org/elasticsearch/action/terms/ShardTermsByQueryRequest.java
index 3a16c84..7f31877 100644
--- a/src/main/java/org/elasticsearch/action/terms/ShardTermsByQueryRequest.java
+++ b/src/main/java/org/elasticsearch/action/terms/ShardTermsByQueryRequest.java
@@ -150,7 +150,7 @@ class ShardTermsByQueryRequest extends BroadcastShardOperationRequest {
} else {
out.writeVInt(0);
}
- out.writeString(field);
+ out.writeString(field); // THIS IS NULL!!