usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject usergrid git commit: Added rudimentary changes to get elastic search working in the query index. Still won't work for core.
Date Wed, 28 Oct 2015 23:54:24 GMT
Repository: usergrid
Updated Branches:
  refs/heads/usergrid2.0es de8608d65 -> 96140d3b7


Added rudimentary changes to get elastic search working in the query index. Still won't work
for core.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/96140d3b
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/96140d3b
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/96140d3b

Branch: refs/heads/usergrid2.0es
Commit: 96140d3b7dd46e28d6dd70649f641f59c3e95772
Parents: de8608d
Author: George Reyes <grey@apache.org>
Authored: Wed Oct 28 16:54:23 2015 -0700
Committer: George Reyes <grey@apache.org>
Committed: Wed Oct 28 16:54:23 2015 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/utils/IndexUtils.java   |   3 +-
 stack/corepersistence/pom.xml                   |   2 +-
 .../usergrid/persistence/index/IndexFig.java    |   2 +-
 .../index/impl/EsEntityIndexImpl.java           | 184 ++++++++++---------
 .../persistence/index/impl/EsProvider.java      |  11 +-
 .../persistence/index/impl/EsQueryVistor.java   |  98 ++++------
 .../index/impl/IndexRefreshCommandImpl.java     |   6 +-
 .../index/impl/NoOpFilterBuilder.java           |   8 +-
 .../index/impl/NoOpQueryBuilder.java            |   6 +-
 .../impl/SearchRequestBuilderStrategy.java      |  25 +--
 .../persistence/index/impl/SortBuilder.java     |   8 +-
 stack/log4j.properties                          |  32 ++++
 12 files changed, 205 insertions(+), 180 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java b/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
index 5fc0f74..c22e5c3 100644
--- a/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
+++ b/stack/core/src/main/java/org/apache/usergrid/utils/IndexUtils.java
@@ -53,7 +53,8 @@ public class IndexUtils {
 
     private static final Logger LOG = LoggerFactory.getLogger( IndexUtils.class );
 
-    static Analyzer analyzer = new StandardAnalyzer( Version.LUCENE_30 );
+    //TODO: GREY does this really need the VERSION.LATEST in the standar analyzer? doesn't
seem to take it anymore
+    static Analyzer analyzer = new StandardAnalyzer(  );
 
 
     private static void buildKeyValueSet( Object node, Map<String, List<Object>>
keyValues, String path,

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/pom.xml b/stack/corepersistence/pom.xml
index 776ad37..d9d60f3 100644
--- a/stack/corepersistence/pom.xml
+++ b/stack/corepersistence/pom.xml
@@ -59,7 +59,7 @@ limitations under the License.
         <commons.collections.version>3.2.1</commons.collections.version>
         <commons.io.version>2.4</commons.io.version>
         <commons.lang.version>3.1</commons.lang.version>
-        <elasticsearch.version>2.0.0-rc1</elasticsearch.version>
+        <elasticsearch.version>2.0.0</elasticsearch.version>
         <fasterxml-uuid.version>3.1.3</fasterxml-uuid.version>
         <guava.version>18.0</guava.version>
         <guice.version>4.0-beta5</guice.version>

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index e093d7d..5a34d7c 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -178,7 +178,7 @@ public interface IndexFig extends GuicyFig {
      * Return the type of Elasticsearch client.  Valid values are NODE or TRANSPORT.
      */
     @Key( ELASTICSEARCH_CLIENT_TYPE )
-    @Default( "NODE")
+    @Default( "TRANSPORT")
     String getClientType();
 
     /**

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 9be591e..069fd25 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -18,48 +18,30 @@
 package org.apache.usergrid.persistence.index.impl;
 
 
-import com.codahale.metrics.Meter;
-import com.codahale.metrics.Timer;
-import com.google.common.base.*;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.io.Resources;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
 
-import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
-import org.apache.usergrid.persistence.core.metrics.ObservableTimer;
-import org.apache.usergrid.persistence.core.migration.data.VersionedData;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.core.util.Health;
-import org.apache.usergrid.persistence.core.util.ValidationUtils;
-import org.apache.usergrid.persistence.index.*;
-import org.apache.usergrid.persistence.index.ElasticSearchQueryBuilder.SearchRequestBuilderStrategyV2;
-import org.apache.usergrid.persistence.index.exceptions.IndexException;
-import org.apache.usergrid.persistence.index.migration.IndexDataVersions;
-import org.apache.usergrid.persistence.index.query.ParsedQuery;
-import org.apache.usergrid.persistence.index.query.ParsedQueryBuilder;
-import org.apache.usergrid.persistence.index.utils.IndexValidationUtils;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 import org.elasticsearch.action.ActionFuture;
-import org.elasticsearch.action.ActionListener;
-import org.elasticsearch.action.ListenableActionFuture;
-import org.elasticsearch.action.ShardOperationFailedException;
 import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
 import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
 import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
 import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
-import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
-import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse;
 import org.elasticsearch.action.search.SearchRequestBuilder;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.search.SearchScrollRequestBuilder;
 import org.elasticsearch.client.AdminClient;
-import org.elasticsearch.common.settings.ImmutableSettings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.TimeValue;
-import org.elasticsearch.index.query.*;
+import org.elasticsearch.index.query.QueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.index.query.TermQueryBuilder;
 import org.elasticsearch.indices.IndexAlreadyExistsException;
 import org.elasticsearch.search.SearchHit;
 import org.elasticsearch.search.SearchHits;
@@ -68,14 +50,43 @@ import org.elasticsearch.search.aggregations.metrics.sum.SumBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import rx.Observable;
+import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
+import org.apache.usergrid.persistence.core.metrics.ObservableTimer;
+import org.apache.usergrid.persistence.core.migration.data.VersionedData;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.Health;
+import org.apache.usergrid.persistence.core.util.ValidationUtils;
+import org.apache.usergrid.persistence.index.CandidateResult;
+import org.apache.usergrid.persistence.index.CandidateResults;
+import org.apache.usergrid.persistence.index.ElasticSearchQueryBuilder.SearchRequestBuilderStrategyV2;
+import org.apache.usergrid.persistence.index.EntityIndex;
+import org.apache.usergrid.persistence.index.EntityIndexBatch;
+import org.apache.usergrid.persistence.index.IndexAlias;
+import org.apache.usergrid.persistence.index.IndexEdge;
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.IndexLocationStrategy;
+import org.apache.usergrid.persistence.index.IndexRefreshCommand;
+import org.apache.usergrid.persistence.index.SearchEdge;
+import org.apache.usergrid.persistence.index.SearchTypes;
+import org.apache.usergrid.persistence.index.exceptions.IndexException;
+import org.apache.usergrid.persistence.index.migration.IndexDataVersions;
+import org.apache.usergrid.persistence.index.query.ParsedQuery;
+import org.apache.usergrid.persistence.index.query.ParsedQueryBuilder;
+import org.apache.usergrid.persistence.index.utils.IndexValidationUtils;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 
-import java.io.IOException;
-import java.net.URL;
-import java.util.*;
+import com.codahale.metrics.Meter;
+import com.codahale.metrics.Timer;
+import com.google.common.base.Charsets;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.io.Resources;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+import rx.Observable;
 
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.APPLICATION_ID_FIELDNAME;
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.applicationId;
 import static org.apache.usergrid.persistence.index.impl.IndexingUtils.parseIndexDocId;
 
 
@@ -191,7 +202,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
             //Create index
             try {
                 final AdminClient admin = esProvider.getClient().admin();
-                Settings settings = ImmutableSettings.settingsBuilder()
+                Settings settings = Settings.settingsBuilder()
                     .put("index.number_of_shards", numberOfShards)
                     .put("index.number_of_replicas", numberOfReplicas)
                         //dont' allow unmapped queries, and don't allow dynamic mapping
@@ -439,8 +450,8 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
 
         //I can't just search on the entity Id.
 
-        FilterBuilder entityEdgeFilter = FilterBuilders.termFilter(IndexingUtils.EDGE_NODE_ID_FIELDNAME,
-            IndexingUtils.nodeId(edge.getNodeId()));
+        QueryBuilder entityEdgeFilter = QueryBuilders.termQuery( IndexingUtils.EDGE_NODE_ID_FIELDNAME,
+            IndexingUtils.nodeId( edge.getNodeId() ) );
 
         srb.setPostFilter(entityEdgeFilter);
 
@@ -507,7 +518,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
 
         final SearchRequestBuilder srb = searchRequestBuilderStrategyV2.getBuilder();
 
-        FilterBuilder entityIdFilter = FilterBuilders.termFilter(IndexingUtils.ENTITY_ID_FIELDNAME,
+        QueryBuilder entityIdFilter = QueryBuilders.termQuery(IndexingUtils.ENTITY_ID_FIELDNAME,
             IndexingUtils.entityId(entityId));
 
         srb.setPostFilter(entityIdFilter);
@@ -564,53 +575,60 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData
{
     }
 
 
-    /**
-     * Completely delete an index.
-     */
+    @Override
     public Observable deleteApplication() {
-        String idString = applicationId(applicationScope.getApplication());
-        final TermQueryBuilder tqb = QueryBuilders.termQuery(APPLICATION_ID_FIELDNAME, idString);
-        final String[] indexes = getIndexes();
-        //Added For Graphite Metrics
-        return Observable.from( indexes ).flatMap( index -> {
-
-            final ListenableActionFuture<DeleteByQueryResponse> response =
-                esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() ).setQuery(
tqb ).execute();
-
-            response.addListener( new ActionListener<DeleteByQueryResponse>() {
-
-                @Override
-                public void onResponse( DeleteByQueryResponse response ) {
-                    checkDeleteByQueryResponse( tqb, response );
-                }
-
-
-                @Override
-                public void onFailure( Throwable e ) {
-                    logger.error( "failed on delete index", e );
-                }
-            } );
-            return Observable.from( response );
-        } ).doOnError( t -> logger.error( "Failed on delete application", t ) );
+        return null;
     }
 
-
-    /**
-     * Validate the response doesn't contain errors, if it does, fail fast at the first error
we encounter
-     */
-    private void checkDeleteByQueryResponse( final QueryBuilder query, final DeleteByQueryResponse
response ) {
-
-        for ( IndexDeleteByQueryResponse indexDeleteByQueryResponse : response ) {
-            final ShardOperationFailedException[] failures = indexDeleteByQueryResponse.getFailures();
-
-            for ( ShardOperationFailedException failedException : failures ) {
-                logger.error( String.format( "Unable to delete by query %s. "
-                        + "Failed with code %d and reason %s on shard %s in index %s", query.toString(),
-                    failedException.status().getStatus(), failedException.reason(),
-                    failedException.shardId(), failedException.index() ) );
-            }
-        }
-    }
+    //TODO: fix how to delete an application. Delete by Query isn't valid in 2.0 elasticsearch
going forward. maybe
+    //a migration to a new index would work better.
+//    /**
+//     * Completely delete an index.
+//     */
+//    public Observable deleteApplication() {
+//        String idString = applicationId(applicationScope.getApplication());
+//        final TermQueryBuilder tqb = QueryBuilders.termQuery(APPLICATION_ID_FIELDNAME,
idString);
+//        final String[] indexes = getIndexes();
+//        //Added For Graphite Metrics
+//        return Observable.from( indexes ).flatMap( index -> {
+//
+//            final ListenableActionFuture<DeleteByQueryResponse> response =
+//                esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() ).setQuery(
tqb ).execute();
+//
+//            response.addListener( new ActionListener<DeleteByQueryResponse>() {
+//
+//                @Override
+//                public void onResponse( DeleteByQueryResponse response ) {
+//                    checkDeleteByQueryResponse( tqb, response );
+//                }
+//
+//
+//                @Override
+//                public void onFailure( Throwable e ) {
+//                    logger.error( "failed on delete index", e );
+//                }
+//            } );
+//            return Observable.from( response );
+//        } ).doOnError( t -> logger.error( "Failed on delete application", t ) );
+//    }
+//
+//
+//    /**
+//     * Validate the response doesn't contain errors, if it does, fail fast at the first
error we encounter
+//     */
+//    private void checkDeleteByQueryResponse( final QueryBuilder query, final DeleteByQueryResponse
response ) {
+//
+//        for ( IndexDeleteByQueryResponse indexDeleteByQueryResponse : response ) {
+//            final ShardOperationFailedException[] failures = indexDeleteByQueryResponse.getFailures();
+//
+//            for ( ShardOperationFailedException failedException : failures ) {
+//                logger.error( String.format( "Unable to delete by query %s. "
+//                        + "Failed with code %d and reason %s on shard %s in index %s",
query.toString(),
+//                    failedException.status().getStatus(), failedException.reason(),
+//                    failedException.shardId(), failedException.index() ) );
+//            }
+//        }
+//    }
 
 
     /**

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
index d94dbae..ab36483 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsProvider.java
@@ -140,17 +140,19 @@ public class EsProvider {
         }
 
         settings.put( "node.name", nodeName );
+        //https://github.com/elastic/elasticsearch/issues/13155
+        settings.put( "path.home", "/");
 
-        TransportClient.Builder transportClient = new TransportClient.Builder().settings(
settings.build() ); //new TransportClient( settings.build() );
+        TransportClient.Builder transportClientBuilder = new TransportClient.Builder().settings(
settings.build() ); //new TransportClient( settings.build() );
+        TransportClient transportClient = transportClientBuilder.build();
 
         // we will connect to ES on all configured hosts
         for ( String host : indexFig.getHosts().split( "," ) ) {
             InetSocketAddress inetSocketAddress = new InetSocketAddress(host ,port );
-            settings.put( new InetSocketTransportAddress( inetSocketAddress ) );
-            transportClient.addTransportAddress( new InetSocketTransportAddress( host, port
) );
+            transportClient.addTransportAddress( new InetSocketTransportAddress( inetSocketAddress)
);
         }
 
-        return transportClient.build();
+        return transportClient;
     }
 
 
@@ -194,6 +196,7 @@ public class EsProvider {
                 .put( "client.transport.ping_timeout", 2000 ) // milliseconds
                 .put( "client.transport.nodes_sampler_interval", 100 ).put( "network.tcp.blocking",
true )
                 .put( "node.client", true ).put( "node.name", nodeName )
+                .put( "path.home", "/")
 
                 .build();
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
index 414f716..fed7664 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsQueryVistor.java
@@ -24,17 +24,13 @@ import java.util.UUID;
 
 import org.elasticsearch.common.geo.GeoDistance;
 import org.elasticsearch.common.unit.DistanceUnit;
-import org.elasticsearch.index.query.BoolFilterBuilder;
 import org.elasticsearch.index.query.BoolQueryBuilder;
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
 import org.elasticsearch.index.query.MatchQueryBuilder;
-import org.elasticsearch.index.query.NestedFilterBuilder;
 import org.elasticsearch.index.query.NestedQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.index.query.RangeFilterBuilder;
-import org.elasticsearch.index.query.TermFilterBuilder;
+import org.elasticsearch.index.query.RangeQueryBuilder;
+import org.elasticsearch.index.query.TermQueryBuilder;
 import org.elasticsearch.index.query.WildcardQueryBuilder;
 import org.elasticsearch.search.sort.GeoDistanceSortBuilder;
 import org.elasticsearch.search.sort.SortBuilders;
@@ -75,7 +71,7 @@ public class EsQueryVistor implements QueryVisitor {
     /**
      * Our queryBuilders for filter operations
      */
-    private final Stack<FilterBuilder> filterBuilders = new Stack<>();
+    private final Stack<QueryBuilder> filterBuilders = new Stack<>();
 
     private final GeoSortFields geoSortFields = new GeoSortFields();
 
@@ -89,12 +85,12 @@ public class EsQueryVistor implements QueryVisitor {
 
         //get all the right
         final QueryBuilder rightQuery = queryBuilders.pop();
-        final FilterBuilder rightFilter = filterBuilders.pop();
+        final QueryBuilder rightFilter = filterBuilders.pop();
 
 
         //get all the left
         final QueryBuilder leftQuery = queryBuilders.pop();
-        final FilterBuilder leftFilter = filterBuilders.pop();
+        final QueryBuilder leftFilter = filterBuilders.pop();
 
 
         //push our boolean filters
@@ -131,7 +127,7 @@ public class EsQueryVistor implements QueryVisitor {
 
         //use left and right
         if ( useLeftFilter && useRightFilter ) {
-            final BoolFilterBuilder fb = FilterBuilders.boolFilter().must(leftFilter).must(rightFilter);
+            final BoolQueryBuilder fb = QueryBuilders.boolQuery().must(leftFilter).must(rightFilter);
             filterBuilders.push( fb );
         }
 
@@ -157,12 +153,12 @@ public class EsQueryVistor implements QueryVisitor {
         op.getRight().visit( this );
 
         final QueryBuilder rightQuery = queryBuilders.pop();
-        final FilterBuilder rightFilter = filterBuilders.pop();
+        final QueryBuilder rightFilter = filterBuilders.pop();
 
 
         //get all the left
         final QueryBuilder leftQuery = queryBuilders.pop();
-        final FilterBuilder leftFilter = filterBuilders.pop();
+        final QueryBuilder leftFilter = filterBuilders.pop();
 
 
         final boolean useLeftQuery = use( leftQuery );
@@ -192,8 +188,8 @@ public class EsQueryVistor implements QueryVisitor {
         final boolean useRightFilter = use(rightFilter);
 
         //use left and right
-        if ( useLeftFilter && useRightFilter ) {
-            final BoolFilterBuilder fb = FilterBuilders.boolFilter().should( leftFilter ).should(
rightFilter );
+        if ( useLeftFilter && useRightQuery ) {
+            final BoolQueryBuilder fb = QueryBuilders.boolQuery().should( leftFilter ).should(
rightFilter );
             filterBuilders.push( fb );
         }
 
@@ -232,12 +228,12 @@ public class EsQueryVistor implements QueryVisitor {
             queryBuilders.push( NoOpQueryBuilder.INSTANCE );
         }
 
-        final FilterBuilder notFilterBuilder = filterBuilders.pop();
+        final QueryBuilder notFilterBuilder = filterBuilders.pop();
 
         //push the filter in
         if ( use( notFilterBuilder ) ) {
 
-            final FilterBuilder notFilter = FilterBuilders.boolFilter().mustNot( notFilterBuilder
) ;
+            final QueryBuilder notFilter = QueryBuilders.boolQuery().mustNot( notFilterBuilder
) ;
 
             //just the root node
             if(!rootNode) {
@@ -245,7 +241,7 @@ public class EsQueryVistor implements QueryVisitor {
             }
             //not the root node, we have to select all to subtract from with the NOT statement
             else{
-                final FilterBuilder selectAllFilter = FilterBuilders.boolFilter().must( FilterBuilders.matchAllFilter())
.must( notFilter );
+                final QueryBuilder selectAllFilter = QueryBuilders.boolQuery().must( QueryBuilders.matchAllQuery())
.must( notFilter );
                 filterBuilders.push( selectAllFilter );
             }
 
@@ -293,8 +289,8 @@ public class EsQueryVistor implements QueryVisitor {
         float distance = op.getDistance().getFloatValue();
 
 
-        final FilterBuilder fb =
-                FilterBuilders.geoDistanceFilter( IndexingUtils.FIELD_LOCATION_NESTED ).lat(
lat ).lon( lon )
+        final QueryBuilder fb =
+                QueryBuilders.geoDistanceQuery( IndexingUtils.FIELD_LOCATION_NESTED ).lat(
lat ).lon( lon )
                               .distance( distance, DistanceUnit.METERS );
 
 
@@ -309,7 +305,7 @@ public class EsQueryVistor implements QueryVisitor {
                 SortBuilders.geoDistanceSort( IndexingUtils.FIELD_LOCATION_NESTED ).unit(
DistanceUnit.METERS )
                             .geoDistance(GeoDistance.SLOPPY_ARC).point(lat, lon);
 
-        final TermFilterBuilder sortPropertyName = sortPropertyTermFilter(name);
+        final TermQueryBuilder sortPropertyName = sortPropertyTermFilter( name );
 
         geoSort.setNestedFilter( sortPropertyName );
 
@@ -328,8 +324,8 @@ public class EsQueryVistor implements QueryVisitor {
         final Object value = op.getLiteral().getValue();
 
 
-        final RangeFilterBuilder termQuery =
-                FilterBuilders.rangeFilter( getFieldNameForType( value ) ).lt(sanitize(value));
+        final RangeQueryBuilder termQuery =
+                QueryBuilders.rangeQuery( getFieldNameForType( value ) ).lt(sanitize(value));
 
 
         queryBuilders.push( NoOpQueryBuilder.INSTANCE );
@@ -346,8 +342,8 @@ public class EsQueryVistor implements QueryVisitor {
         final Object value = op.getLiteral().getValue();
 
 
-        final RangeFilterBuilder termQuery =
-                FilterBuilders.rangeFilter( getFieldNameForType( value ) ).lte(sanitize(value));
+        final RangeQueryBuilder termQuery =
+                QueryBuilders.rangeQuery( getFieldNameForType( value ) ).lte(sanitize(value));
 
 
         queryBuilders.push( NoOpQueryBuilder.INSTANCE );
@@ -378,8 +374,8 @@ public class EsQueryVistor implements QueryVisitor {
             }
 
             //it's an exact match, use a filter
-            final TermFilterBuilder termFilter =
-                    FilterBuilders.termFilter( IndexingUtils.FIELD_STRING_NESTED_UNANALYZED,
stringValue );
+            final TermQueryBuilder termFilter =
+                    QueryBuilders.termQuery( IndexingUtils.FIELD_STRING_NESTED_UNANALYZED,
stringValue );
 
             queryBuilders.push( NoOpQueryBuilder.INSTANCE );
             filterBuilders.push( fieldNameTerm( name, termFilter ) );
@@ -389,8 +385,8 @@ public class EsQueryVistor implements QueryVisitor {
 
         // assume all other types need prefix
 
-        final TermFilterBuilder termQuery =
-                FilterBuilders.termFilter(getFieldNameForType(value), sanitize(value));
+        final TermQueryBuilder termQuery =
+                QueryBuilders.termQuery( getFieldNameForType( value ), sanitize( value )
);
 
         filterBuilders.push( fieldNameTerm( name, termQuery ) );
 
@@ -404,8 +400,8 @@ public class EsQueryVistor implements QueryVisitor {
         final Object value = op.getLiteral().getValue();
 
 
-        final RangeFilterBuilder rangeQuery =
-                FilterBuilders.rangeFilter( getFieldNameForType( value ) ).gt(sanitize(value));
+        final RangeQueryBuilder rangeQuery =
+                QueryBuilders.rangeQuery( getFieldNameForType( value ) ).gt(sanitize(value));
 
         filterBuilders.push( fieldNameTerm( name, rangeQuery ) );
 
@@ -419,8 +415,8 @@ public class EsQueryVistor implements QueryVisitor {
         Object value = op.getLiteral().getValue();
 
 
-        final RangeFilterBuilder rangeQuery =
-                FilterBuilders.rangeFilter( getFieldNameForType( value ) ).gte(sanitize(value));
+        final RangeQueryBuilder rangeQuery =
+                QueryBuilders.rangeQuery( getFieldNameForType( value ) ).gte(sanitize(value));
 
         filterBuilders.push(fieldNameTerm(name, rangeQuery));
 
@@ -429,12 +425,12 @@ public class EsQueryVistor implements QueryVisitor {
 
 
     @Override
-    public Optional<FilterBuilder> getFilterBuilder() {
+    public Optional<QueryBuilder> getFilterBuilder() {
         if ( filterBuilders.empty() ) {
             return Optional.absent();
         }
 
-        final FilterBuilder builder = filterBuilders.peek();
+        final QueryBuilder builder = filterBuilders.peek();
 
         if ( !use( builder ) ) {
             return Optional.absent();
@@ -466,36 +462,19 @@ public class EsQueryVistor implements QueryVisitor {
         return geoSortFields;
     }
 
-
-    /**
-     * Generate the field name term for the field name  for queries
-     */
-    private NestedQueryBuilder fieldNameTerm( final String fieldName, final QueryBuilder
fieldValueQuery ) {
-
-        final BoolQueryBuilder booleanQuery = QueryBuilders.boolQuery();
-
-        booleanQuery.must( QueryBuilders.termQuery(IndexingUtils.FIELD_NAME_NESTED, fieldName)
);
-
-        booleanQuery.must( fieldValueQuery );
-
-
-        return QueryBuilders.nestedQuery(IndexingUtils.ENTITY_FIELDS, booleanQuery);
-    }
-
-
     /**
      * Generate the field name term for the field name for filters
      */
-    private NestedFilterBuilder fieldNameTerm( final String fieldName, final FilterBuilder
fieldValueBuilder ) {
+    private NestedQueryBuilder fieldNameTerm( final String fieldName, final QueryBuilder
fieldValueBuilder ) {
 
-        final BoolFilterBuilder booleanQuery = FilterBuilders.boolFilter();
+        final BoolQueryBuilder booleanQuery = QueryBuilders.boolQuery();
 
-        booleanQuery.must( FilterBuilders.termFilter( IndexingUtils.FIELD_NAME_NESTED, fieldName
) );
+        booleanQuery.must( QueryBuilders.termQuery( IndexingUtils.FIELD_NAME_NESTED, fieldName
) );
 
         booleanQuery.must( fieldValueBuilder );
 
 
-        return FilterBuilders.nestedFilter( IndexingUtils.ENTITY_FIELDS, booleanQuery );
+        return QueryBuilders.nestedQuery( IndexingUtils.ENTITY_FIELDS, booleanQuery );
     }
 
 
@@ -542,19 +521,10 @@ public class EsQueryVistor implements QueryVisitor {
         return input;
     }
 
-
     /**
      * Return false if our element is a no-op, true otherwise
      */
     private boolean use( final QueryBuilder queryBuilder ) {
         return queryBuilder != NoOpQueryBuilder.INSTANCE;
     }
-
-
-    /**
-     * Return false if our element is a no-op, true otherwise
-     */
-    private boolean use( final FilterBuilder filterBuilder ) {
-        return filterBuilder != NoOpFilterBuilder.INSTANCE;
-    }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
index 087eefe..7002267 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
@@ -27,7 +27,7 @@ import org.apache.usergrid.persistence.index.*;
 import org.elasticsearch.action.ShardOperationFailedException;
 import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
 import org.elasticsearch.action.search.SearchRequestBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
+import org.elasticsearch.index.query.QueryBuilders;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -124,8 +124,8 @@ public class IndexRefreshCommandImpl implements IndexRefreshCommand {
                     for(int i = 0; i<indexFig.maxRefreshSearches();i++) {
                         final SearchRequestBuilder builder = esProvider.getClient().prepareSearch(alias.getReadAlias())
                             .setTypes(IndexingUtils.ES_ENTITY_TYPE)
-                            .setPostFilter(FilterBuilders
-                                .termFilter(IndexingUtils.ENTITY_ID_FIELDNAME,
+                            //investigate to see if this is functionally the same.
+                            .setPostFilter( QueryBuilders.termQuery(IndexingUtils.ENTITY_ID_FIELDNAME,
                                     entityId));
 
                         info = new IndexRefreshCommandInfo(builder.execute().get().getHits().totalHits()
> 0,

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpFilterBuilder.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpFilterBuilder.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpFilterBuilder.java
index 9eca433..ae8b35e 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpFilterBuilder.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpFilterBuilder.java
@@ -22,20 +22,20 @@ package org.apache.usergrid.persistence.index.impl;
 
 import java.io.IOException;
 
+import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.XContentBuilder;
-import org.elasticsearch.index.query.BaseFilterBuilder;
+import org.elasticsearch.index.query.QueryBuilder;
 
 
 /**
  * Marker interface that does nothing
  */
-public class NoOpFilterBuilder extends BaseFilterBuilder {
+public class NoOpFilterBuilder extends QueryBuilder { //BaseQueryBuilder { //BaseFilterBuilder
{
 
     public static final NoOpFilterBuilder INSTANCE = new NoOpFilterBuilder();
 
-
     @Override
-    protected void doXContent( final XContentBuilder builder, final Params params ) throws
IOException {
+    protected void doXContent( final XContentBuilder builder, final ToXContent.Params params
) throws IOException {
         //no op
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpQueryBuilder.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpQueryBuilder.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpQueryBuilder.java
index 2498812..835be91 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpQueryBuilder.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/NoOpQueryBuilder.java
@@ -22,20 +22,20 @@ package org.apache.usergrid.persistence.index.impl;
 
 import java.io.IOException;
 
+import org.elasticsearch.common.xcontent.ToXContent;
 import org.elasticsearch.common.xcontent.XContentBuilder;
-import org.elasticsearch.index.query.BaseQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilder;
 
 
 /**
  * Marker interface that does nothing
  */
-public class NoOpQueryBuilder extends BaseQueryBuilder implements QueryBuilder {
+public class NoOpQueryBuilder extends QueryBuilder {
 
     public static final NoOpQueryBuilder INSTANCE = new NoOpQueryBuilder();
 
     @Override
-    protected void doXContent( final XContentBuilder builder, final Params params ) throws
IOException {
+    protected void doXContent( final XContentBuilder builder, final ToXContent.Params params
) throws IOException {
          //no op
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
index a5c1af3..1490787 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SearchRequestBuilderStrategy.java
@@ -23,11 +23,11 @@ package org.apache.usergrid.persistence.index.impl;
 import org.apache.usergrid.persistence.index.IndexAlias;
 import org.elasticsearch.action.search.SearchRequestBuilder;
 import org.elasticsearch.action.search.SearchType;
-import org.elasticsearch.index.query.BoolFilterBuilder;
-import org.elasticsearch.index.query.FilterBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+
 import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.query.TermFilterBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.index.query.TermQueryBuilder;
 import org.elasticsearch.search.sort.FieldSortBuilder;
 import org.elasticsearch.search.sort.GeoDistanceSortBuilder;
 import org.elasticsearch.search.sort.SortBuilders;
@@ -195,7 +195,7 @@ public class SearchRequestBuilderStrategy {
      * Create our filter builder.  We need to restrict our results on edge search, as well
as on types, and any filters
      * that came from the grammar.
      */
-    private FilterBuilder createFilterBuilder( final SearchEdge searchEdge, final QueryVisitor
visitor,
+    private QueryBuilder createFilterBuilder( final SearchEdge searchEdge, final QueryVisitor
visitor,
                                                final SearchTypes searchTypes ) {
         String context = createContextName( applicationScope, searchEdge );
 
@@ -208,10 +208,10 @@ public class SearchRequestBuilderStrategy {
         // Do we need to put the context term first for performance?
 
         //make sure we have entity in the context
-        BoolFilterBuilder boolQueryFilter = FilterBuilders.boolFilter();
+        BoolQueryBuilder boolQueryFilter = QueryBuilders.boolQuery();
 
         //add our edge search
-        boolQueryFilter.must( FilterBuilders.termFilter( IndexingUtils.EDGE_SEARCH_FIELDNAME,
context ) );
+        boolQueryFilter.must( QueryBuilders.termQuery( IndexingUtils.EDGE_SEARCH_FIELDNAME,
context ) );
 
 
         /**
@@ -221,19 +221,20 @@ public class SearchRequestBuilderStrategy {
 
 
         if ( sourceTypes.length > 0 ) {
-            final FilterBuilder[] typeTerms = new FilterBuilder[sourceTypes.length];
+            final QueryBuilder[] typeTerms = new QueryBuilder[sourceTypes.length];
 
             for ( int i = 0; i < sourceTypes.length; i++ ) {
-                typeTerms[i] = FilterBuilders.termFilter( IndexingUtils.ENTITY_TYPE_FIELDNAME,
sourceTypes[i] );
+                typeTerms[i] = QueryBuilders.termQuery( IndexingUtils.ENTITY_TYPE_FIELDNAME,
sourceTypes[i] );
             }
 
             //add all our types, 1 type must match per query
-            boolQueryFilter.must( FilterBuilders.orFilter( typeTerms ) );
+            //TODO: GREY change the bool query to the not depreciated version.
+            boolQueryFilter.must( QueryBuilders.orQuery( typeTerms ) );
         }
 
         //if we have a filter from our visitor, add it
 
-        Optional<FilterBuilder> queryBuilder = visitor.getFilterBuilder();
+        Optional<QueryBuilder> queryBuilder = visitor.getFilterBuilder();
 
         if ( queryBuilder.isPresent() ) {
             boolQueryFilter.must( queryBuilder.get() );
@@ -273,7 +274,7 @@ public class SearchRequestBuilderStrategy {
     private FieldSortBuilder createSort( final SortOrder sortOrder, final String fieldName,
                                          final String propertyName ) {
 
-        final TermFilterBuilder propertyFilter = sortPropertyTermFilter( propertyName );
+        final TermQueryBuilder propertyFilter = sortPropertyTermFilter( propertyName );
 
 
         return SortBuilders.fieldSort( fieldName ).order( sortOrder ).setNestedFilter( propertyFilter
);

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SortBuilder.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SortBuilder.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SortBuilder.java
index ad78be7..f487747 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SortBuilder.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/SortBuilder.java
@@ -24,8 +24,8 @@
 package org.apache.usergrid.persistence.index.impl;
 
 
-import org.elasticsearch.index.query.FilterBuilders;
-import org.elasticsearch.index.query.TermFilterBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.index.query.TermQueryBuilder;
 
 
 /**
@@ -37,8 +37,8 @@ public class SortBuilder {
     /**
      * Create a term filter for our sorts
      */
-    public static TermFilterBuilder sortPropertyTermFilter( final String propertyName ) {
-        return FilterBuilders.termFilter( IndexingUtils.FIELD_NAME, propertyName );
+    public static TermQueryBuilder sortPropertyTermFilter( final String propertyName ) {
+        return QueryBuilders.termQuery( IndexingUtils.FIELD_NAME, propertyName );
     }
 
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/96140d3b/stack/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/log4j.properties b/stack/log4j.properties
new file mode 100644
index 0000000..45cba0b
--- /dev/null
+++ b/stack/log4j.properties
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF 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
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# for production, you should probably set the root to INFO
+# and the pattern to %c instead of %l.  (%l is slower.)
+
+# output messages into a rolling log file as well as stdout
+log4j.rootLogger=ERROR,stdout
+
+# stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+#log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p (%t) [%c] - %m%n
+
+log4j.logger.org.apache.usergrid.tools=ERROR
+
+
+


Mime
View raw message