Skip to content

Instantly share code, notes, and snippets.

@rkroll
rkroll / gist:5752210
Created June 10, 2013 20:56
Geopoint Calculation facet
{
"query" : {
"match_all" : { }
},
"facets" : {
"tag" : {
"terms" : {
"field" : "geopoint_calc_method",
"size" : 10
}
@rkroll
rkroll / gist:5645851
Created May 24, 2013 19:14
Counts of geocoded addresses
Get count of geocoded addresses:
curl -v 'http://cass3:9200/addresses/address/_count' -d '{
"constant_score": {
"filter": {
"not": {
"missing": {
"field": "geo_point"
}
}
}
addresses/address/_count w/ body"
{
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"or": [
{
"missing": {
{
"query": {
"match_all": {}
},
"size": 0,
"facets": {
"tags": {
"terms": {
"field": "addr_city.untouched",
"size": 200
@rkroll
rkroll / gist:5583915
Created May 15, 2013 13:13
No Parcel Geocode
<GeocodeEntity Id="200000095269">
<GeocodeRequest>
<Address AddressLine="21691 CYPRESS RD APT 16B" AdminDistrict="FL" Locality="BOCA RATON" PostalCode="33433-3343"/>
</GeocodeRequest>
<GeocodeResponse Name="21691 Cypress Rd, Boca Raton, FL 33433" EntityType="Address" Confidence="High" MatchCodes="Good">
<Address AddressLine="21691 Cypress Rd" AdminDistrict="FL" CountryRegion="United States"
AdminDistrict2="Palm Beach Co." FormattedAddress="21691 Cypress Rd, Boca Raton, FL 33433"
Locality="Boca Raton" PostalCode="33433"/>
<GeocodePoint CalculationMethod="InterpolationOffset" Latitude="26.3528671860695" Longitude="-80.1781200617552"
Type="Point" UsageTypes="Display"/>
@rkroll
rkroll / gist:5444957
Created April 23, 2013 16:08
Run a faunus job
final String file = "bin/titan-cassandra-input.properties";
final Properties fileConfiguration = new Properties();
final Properties commandLineConfiguration = new Properties();
fileConfiguration.load(new FileInputStream(file));
final Configuration conf = new Configuration();
for (Map.Entry<Object, Object> entry : fileConfiguration.entrySet()) {
conf.set(entry.getKey().toString(), entry.getValue().toString());
}
@rkroll
rkroll / faunus_cassandra.pom.diff
Created April 18, 2013 18:11
faunus pom.xml diff
faunus_pom.xml.diff
diff --git a/bin/titan-cassandra-input.properties b/bin/titan-cassandra-input.properties
index 073ca9b..4b92305 100644
--- a/bin/titan-cassandra-input.properties
+++ b/bin/titan-cassandra-input.properties
@@ -1,6 +1,7 @@
# input graph parameters
faunus.graph.input.format=com.thinkaurelius.faunus.formats.titan.cassandra.TitanCassandraInputFormat
faunus.graph.input.titan.storage.backend=com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftStoreManager
+#faunus.graph.input.titan.storage.backend=com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager
TitanGraph g = titanGraphService.getSingleton()
In a job:
while(true) {
Vertex vertex = g.addVertex(null);
vertex.setProperty("foo", "bar");
batchCount++;
if(batchCount % 1000 == 0) { g.commit() }
}
Server Software: Jetty(7.4.5.v20110725)
Server Hostname: localhost
Server Port: 8080
Document Path: /short-sale/
Document Length: 55071 bytes
Concurrency Level: 100
Time taken for tests: 71.724 seconds
Complete requests: 10000
@rkroll
rkroll / gist:5215263
Created March 21, 2013 18:09
ES-array-field-query
curl -XPUT 'http://localhost:9200/demo/index/loc' -d '{
"locations" : [
"Oakland Park, FLORIDA",
"33309",
"Florida"
]
}'
curl -XGET 'http://localhost:9200/demo/_search?' -d '
{