108 Commits

Author SHA1 Message Date
Tal Levy
cf1c393d70 Merge pull request #15166 from talevy/remove_pattern_utils
move PatternUtils#loadBankFromStream into GrokProcessor.Factory
2015-12-03 08:08:00 -08:00
Martijn van Groningen
6acf8ec263 Removed pipeline tests with a simpler tests
The PipelineTests tried to test if the configured map/list in set processor wasn't modified while documents were ingested. Creating a pipeline programmatically created more noise than the test needed. The new tests in IngestDocumentTests have the same goal, but is much smaller and clearer by directly testing against IngestDocument.
2015-12-03 15:19:04 +01:00
Martijn van Groningen
270a3977bc Removed the lazy cache in DatabaseReaderService and eagerly build all available databases. 2015-12-02 11:16:02 +01:00
Tal Levy
767bd1d4d5 move PatternUtils#loadBankFromStream into GrokProcessor.Factory 2015-12-01 15:46:02 -08:00
javanna
6c0510b01d Make rename processor less error prone
Rename processor now checks whether the field to rename exists and throws exception if it doesn't. It also checks that the new field to rename to doesn't exist yet, and throws exception otherwise. Also we make sure that the rename operation is atomic, otherwise things may break between the remove and the set and we'd leave the document in an inconsistent state.

Note that the requirement for the new field name to not exist simplifies the usecase for e.g. { "rename" : { "list.1": "list.2"} } as such a rename wouldn't be accepted if list is actually a list given that either list.2 already exists or the index is out of bounds for the existing list. If one really wants to replace an existing field, that field needs to be removed first through remove processor and then rename can be used.
2015-12-01 19:58:24 +01:00
Martijn van Groningen
15b6708a5d and now make use of the lifecycle infrastructure 2015-12-01 18:20:25 +01:00
Tal Levy
8e4c288b5c Merge pull request #15132 from talevy/no_match_for_grok
[Ingest] No match for grok
2015-12-01 09:13:11 -08:00
Tal Levy
2c1effdd41 throw exception when grok processor does not match 2015-12-01 08:58:58 -08:00
Martijn van Groningen
9dd52ad7d3 Removed pollution from the Processor.Factory interface.
1) It no longer extends from Closeable.
2) Removed the config directory setter. Implementation that relied on it, now get the location to the config dir via their constructors.
2015-12-01 17:32:37 +01:00
Martijn van Groningen
fa9fcb3b11 geo processor should add a list of doubles instead of an array to the ingest document 2015-12-01 17:12:34 +01:00
Martijn van Groningen
99a4295330 If a list or map value gets set on ingest document a deep copy needs to be made.
If this is not done this can lead to processor configuration being changed by an bulk or index request.
2015-12-01 16:02:04 +01:00
Martijn van Groningen
4402da1af0 also change the tests to deal with Exception instead of IOException 2015-11-30 15:45:40 +01:00
Martijn van Groningen
dde274d944 Replaced IOException with Exception on factory implementations' Processor.Factory#create(Map) method. 2015-11-30 15:37:16 +01:00
Martijn van Groningen
fdf4543b8e Renamed add processor to set processor.
This name makes more sense, because if a field already exists it overwrites it.
2015-11-30 15:03:20 +01:00
javanna
43b861b076 IngestDocument to support accessing and modifying list items
When reading, through #getFieldValue and #hasField, and a list is encountered, the next element in the path is treated as the index of the item that the path points to (e.g. `list.0.key`). If the index is not a number or out of bounds, an exception gets thrown.

Added #appendFieldValue method that has the same behaviour as setFieldValue, but when a list is the last element in the path, instead of replacing the whole list it will simply add a new element to the existing list. This method is currently unused, we have to decide whether the set processor or a new processor should use it.

A few other changes made:
- Renamed hasFieldValue to hasField, as this method is not really about values but only keys. It will return true if a key is there but its value is null, while it returns false only when a field is not there at all.
- Changed null semantic in getFieldValue. null gets returned only when it was an actual value in the source, an exception is thrown otherwise when trying to access a non existing field, so that null != field not present.
- Made remove stricter about non existing fields. Throws error when trying to remove a non existing field. This is more consistent with the other methods in IngestDocument which are strict about fields that are not present.

Relates to #14324
2015-11-30 13:58:03 +01:00
Martijn van Groningen
0fe1b4eab1 PipelineStore no longer is a lifecycle component
Client in PipelineStore gets provided via a guice provider
Processor and Factory throw Exception instead of IOException
Removed PipelineExecutionService.Listener with ActionListener
2015-11-26 18:12:15 +01:00
Martijn van Groningen
9aff8c6352 fix compile errors 2015-11-26 17:00:16 +01:00
Martijn van Groningen
9d1fa0d6da ingest: Add meta processor that allows to modify the metadata attributes of document being processed 2015-11-26 15:46:32 +01:00
Martijn van Groningen
afc9069c99 * Inlined PipelineStoreClient class into the PipelineStore class
* Moved PipelineReference to a top level class and named it PipelineDefinition
* Pulled some logic from the crud transport classes to the PipelineStore
* Use IOUtils#close(...) where appropriate
2015-11-26 14:42:39 +01:00
javanna
1a7391070f Simulate api improvements
Move ParsedSimulateRequest to SimulatePipelineRequest and remove Parser class in favor of static parse methods.
Simplified execute methods in SimulateExecutionService.
2015-11-26 13:24:45 +01:00
Martijn van Groningen
2890432421 made updatePipelines() to not make it prone to race conditions 2015-11-25 18:32:56 +01:00
javanna
5d510b59c8 use MetaData enum for metadata field names
Also rename getName to getFieldName in MetaData to prevent confusion with name() enum method.
2015-11-25 18:08:53 +01:00
javanna
ec162c458e Replace property with field in IngestDocument
getPropertyValue => getFieldValue
hasPropertyValue => hasFieldValue
setPropertyValue => setFieldValue
removeProperty => removeField
2015-11-25 18:08:53 +01:00
Luca Cavanna
e15fa99ee3 Merge pull request #15019 from javanna/enhancement/java8_date_parser
date formats: use a function instead of our own interface
2015-11-25 16:17:39 +01:00
javanna
c4cf55c196 [TEST] generate random timezone out of the available ones in joda 2015-11-25 15:58:01 +01:00
javanna
5daa73b350 date formats: use a function instead of our own interface
Also turn the different date formats into an enum.
2015-11-25 15:37:35 +01:00
javanna
e0fcee642e [TEST] fix locale comparison 2015-11-25 10:26:46 +01:00
javanna
388e637fa9 add a few more asserts to IngestActionFilterTests 2015-11-24 19:43:54 +01:00
javanna
49bfe6410e Rename Data leftovers 2015-11-24 15:49:25 +01:00
javanna
8f1f5d4da0 Split mutate processor into one processor per function 2015-11-24 14:31:53 +01:00
Martijn van Groningen
1e9d5c7b22 test: also test what happens if all index requests fail to be processed by the pipeline 2015-11-24 13:41:40 +01:00
Martijn van Groningen
8b1f117e51 Instead of failing the entire bulk request if the pipeline fails, only fail a bulk item. 2015-11-24 12:40:30 +01:00
Martijn van Groningen
ecc8158b89 renamed Data to IngestDocument
moved all metadata related fields to a single metadata map
removed specific metadata getters with a generic getMetadata()
2015-11-23 18:24:42 +01:00
javanna
bb298ed27a add some javadocs to Data#getDocument 2015-11-20 18:01:27 +01:00
javanna
be3e913349 set Data modified flag when a property is removed and improve behaviour when adding a field 2015-11-20 17:59:45 +01:00
javanna
404ae395ca add javadocs for Data#removeProperty 2015-11-18 18:00:25 +01:00
javanna
59868cd02e add support for removeProperty 2015-11-18 17:28:37 +01:00
javanna
ab5b649184 accept null values and adapt hasPropertyValue return value 2015-11-18 10:46:03 +01:00
javanna
ba8f8810ea rename getProperty, containsProperty and addField methods
For more consistency we now have getPropertyValue, hasPropertyValue, and setPropertyValue
2015-11-18 10:46:03 +01:00
javanna
126df4ca9a type safety in Data#getProperty and proper error when type found is not the expected one 2015-11-18 10:46:03 +01:00
javanna
e616e8398a add missing javadocs 2015-11-18 10:46:03 +01:00
javanna
044a86d6c6 remove dependency on core and resolve generics compiler warning 2015-11-18 10:46:03 +01:00
javanna
ba7e536e1d better error and tests for empty and null values in Data containsProperty addField and getProperty 2015-11-18 10:46:03 +01:00
javanna
9d7d5bd9bc Throw a proper error when add field fails due to existing field type mismatch
Instead of throwing ClassCastException whenever we try and add a field to a parent that is not a Map, we now throw a clearer error (IAE).
2015-11-18 10:46:02 +01:00
Luca Cavanna
68cefe1d81 Merge pull request #14759 from talevy/fix_null_mutate_report
adds tests and guards against null values in some mutate methods
2015-11-16 10:32:32 +01:00
javanna
5169d9d80f minor formatting changes 2015-11-16 10:28:29 +01:00
Tal Levy
de33f5a911 adds tests and guards against null values in some mutate methods 2015-11-15 21:57:27 -08:00
javanna
446fa0c10b remove unnecessary line breaks 2015-11-13 19:37:06 +01:00
javanna
26569045ef remove leftover equals/hashcode 2015-11-13 19:36:18 +01:00
javanna
97f4f27b14 remove equals/hashcode as part of Pipeline and adapt tests
Only MutateProcessor implemented equals / hashcode hence we would only use that one in our tests, since they relied on them. Better to not rely on equals/hashcode, drop them and mock processor/pipeline in our tests that need them. That also allow to make MutateProcessor constructor package private as the other processors.
2015-11-13 19:35:09 +01:00