Github user dlyle65535 commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/67#discussion_r58528158
--- Diff:
metron-streaming/Metron-Common/src/main/java/org/apache/metron/bolt/BulkMessageWriterBolt.java
---
@@ -66,23 +67,21 @@ public void prepare(Map stormConf, TopologyContext
context, OutputCollector coll
public void execute(Tuple tuple) {
JSONObject message = (JSONObject)((JSONObject)
tuple.getValueByField("message")).clone();
message.put("index." +
bulkMessageWriter.getClass().getSimpleName().toLowerCase() + ".ts", "" +
System.currentTimeMillis());
- String sourceType = TopologyUtils.getSourceType(message);
- SourceConfig configuration = configurations.get(sourceType);
- int batchSize = configuration != null ? configuration.getBatchSize() :
1;
- List<Tuple> tupleList = sourceTupleMap.get(sourceType);
+ String sensorType = TopologyUtils.getSensorType(message);
+ SensorEnrichmentConfig sensorEnrichmentConfig =
configurations.getSensorEnrichmentConfig(sensorType);
+ int batchSize = sensorEnrichmentConfig != null ?
sensorEnrichmentConfig.getBatchSize() : 1;
+ List<Tuple> tupleList = sensorTupleMap.get(sensorType);
if (tupleList == null) tupleList = new ArrayList<>();
tupleList.add(tuple);
- List<JSONObject> messageList = sourceMessageMap.get(sourceType);
+ List<JSONObject> messageList = sensorMessageMap.get(sensorType);
if (messageList == null) messageList = new ArrayList<>();
messageList.add(message);
if (messageList.size() < batchSize) {
- sourceTupleMap.put(sourceType, tupleList);
- sourceMessageMap.put(sourceType, messageList);
+ sensorTupleMap.put(sensorType, tupleList);
+ sensorMessageMap.put(sensorType, messageList);
} else {
try {
-
- String esType = sourceType + "_doc";
- bulkMessageWriter.write(esType, configuration, tupleList,
messageList);
+ bulkMessageWriter.write(sensorType, configurations, tupleList,
messageList);
--- End diff --
I think this will break the UI. The query it launches looks is ```"query":
"_type:sensorType_doc"``` rather than sensorType. That esType was the fix I put
in back when I first got here to make the UI work. I had added it to the writer
to keep the ES/UI implementation details out of the rest of the topology.
Alternatively, we could change the UI query. But right now, I don't see a
way we will see documents in the UI with this as is.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---