Skip to content

Commit

Permalink
Rename ES type "graylog_meta" to "index_range"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jochen Schalanda committed Jul 2, 2015
1 parent 59df30b commit 9378436
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Expand Up @@ -39,7 +39,7 @@
@Singleton @Singleton
public class IndexMapping { public class IndexMapping {
public static final String TYPE_MESSAGE = "message"; public static final String TYPE_MESSAGE = "message";
public static final String TYPE_META = "graylog_meta"; public static final String TYPE_INDEX_RANGE = "index_range";


private final Client client; private final Client client;


Expand Down
Expand Up @@ -206,7 +206,7 @@ public boolean create(String indexName) {
indexMapping.createMapping(indexName, IndexMapping.TYPE_MESSAGE, messageMapping).actionGet(); indexMapping.createMapping(indexName, IndexMapping.TYPE_MESSAGE, messageMapping).actionGet();
final Map<String, Object> metaMapping = indexMapping.metaMapping(); final Map<String, Object> metaMapping = indexMapping.metaMapping();
final PutMappingResponse metaMappingResponse = final PutMappingResponse metaMappingResponse =
indexMapping.createMapping(indexName, IndexMapping.TYPE_META, metaMapping).actionGet(); indexMapping.createMapping(indexName, IndexMapping.TYPE_INDEX_RANGE, metaMapping).actionGet();


return messageMappingResponse.isAcknowledged() && metaMappingResponse.isAcknowledged(); return messageMappingResponse.isAcknowledged() && metaMappingResponse.isAcknowledged();
} }
Expand Down
Expand Up @@ -94,7 +94,7 @@ public EsIndexRangeService(Client client, ActivityWriter activityWriter, ObjectM
@Nullable @Nullable
public IndexRange get(String index) throws NotFoundException { public IndexRange get(String index) throws NotFoundException {
final GetRequest request = new GetRequestBuilder(client, index) final GetRequest request = new GetRequestBuilder(client, index)
.setType(IndexMapping.TYPE_META) .setType(IndexMapping.TYPE_INDEX_RANGE)
.setId(index) .setId(index)
.request(); .request();


Expand Down Expand Up @@ -139,7 +139,7 @@ public SortedSet<IndexRange> find(DateTime begin, DateTime end) {
.must(beginRangeQuery) .must(beginRangeQuery)
.must(endRangeQuery); .must(endRangeQuery);
final SearchRequest request = client.prepareSearch() final SearchRequest request = client.prepareSearch()
.setTypes(IndexMapping.TYPE_META) .setTypes(IndexMapping.TYPE_INDEX_RANGE)
.setQuery(completeRangeQuery) .setQuery(completeRangeQuery)
.request(); .request();


Expand All @@ -158,7 +158,7 @@ public SortedSet<IndexRange> find(DateTime begin, DateTime end) {
@Override @Override
public SortedSet<IndexRange> findAll() { public SortedSet<IndexRange> findAll() {
final SearchRequest request = client.prepareSearch() final SearchRequest request = client.prepareSearch()
.setTypes(IndexMapping.TYPE_META) .setTypes(IndexMapping.TYPE_INDEX_RANGE)
.setQuery(QueryBuilders.matchAllQuery()) .setQuery(QueryBuilders.matchAllQuery())
.request(); .request();


Expand All @@ -179,7 +179,7 @@ public void destroy(String index) {
final DeleteRequest request = client.prepareDelete() final DeleteRequest request = client.prepareDelete()
.setIndex(index) .setIndex(index)
.setId(index) .setId(index)
.setType(IndexMapping.TYPE_META) .setType(IndexMapping.TYPE_INDEX_RANGE)
.setRefresh(true) .setRefresh(true)
.request(); .request();


Expand All @@ -202,7 +202,7 @@ public void destroy(String index) {
public void destroyAll() { public void destroyAll() {
final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(1L)); final Scroll scroll = new Scroll(TimeValue.timeValueMinutes(1L));
final SearchRequest searchRequest = client.prepareSearch() final SearchRequest searchRequest = client.prepareSearch()
.setTypes(IndexMapping.TYPE_META) .setTypes(IndexMapping.TYPE_INDEX_RANGE)
.setSearchType(SearchType.SCAN) .setSearchType(SearchType.SCAN)
.setScroll(scroll) .setScroll(scroll)
.setQuery(QueryBuilders.matchAllQuery()) .setQuery(QueryBuilders.matchAllQuery())
Expand Down Expand Up @@ -304,7 +304,7 @@ public void save(IndexRange indexRange) {


final IndexRequest request = client.prepareIndex() final IndexRequest request = client.prepareIndex()
.setIndex(indexName) .setIndex(indexName)
.setType(IndexMapping.TYPE_META) .setType(IndexMapping.TYPE_INDEX_RANGE)
.setId(indexName) .setId(indexName)
.setRefresh(true) .setRefresh(true)
.setSource(source) .setSource(source)
Expand Down
Expand Up @@ -193,7 +193,7 @@
{ {
"index": { "index": {
"indexName": "graylog_1", "indexName": "graylog_1",
"indexType": "graylog_meta", "indexType": "index_range",
"indexId": "graylog_1" "indexId": "graylog_1"
} }
}, },
Expand All @@ -213,7 +213,7 @@
{ {
"index": { "index": {
"indexName": "graylog_2", "indexName": "graylog_2",
"indexType": "graylog_meta", "indexType": "index_range",
"indexId": "graylog_2" "indexId": "graylog_2"
} }
}, },
Expand All @@ -229,4 +229,4 @@
] ]
} }
] ]
} }
Expand Up @@ -5,7 +5,7 @@
{ {
"index" : { "index" : {
"indexName": "graylog_0", "indexName": "graylog_0",
"indexType": "graylog_meta", "indexType": "index_range",
"indexId": "graylog_0" "indexId": "graylog_0"
} }
}, },
Expand Down

0 comments on commit 9378436

Please sign in to comment.