Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ignore_missing option to SplitProcessor #20982

Merged
merged 1 commit into from
Nov 16, 2016
Merged

Conversation

talevy
Copy link
Contributor

@talevy talevy commented Oct 17, 2016

Similar to the additional ignore_missing param that was added to many of the processors from: #19995.

When option is true, null-valued and non-existent fields will not result in a thrown exception.

Closes #20840.

@talevy talevy added >enhancement :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP v6.0.0-alpha1 v5.1.1 labels Oct 17, 2016
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a small comment and a question, LGTM otherwise.

@@ -23,6 +23,7 @@
import org.elasticsearch.ingest.ConfigurationUtils;
import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.Processor;
import org.jcodings.Config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import?

if (oldVal == null) {
String oldVal;

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should replace this try-catch block with the a new helper method in IngestDocument?

public <T> T getFieldValue(String path, Class<T> clazz, boolean ignoreMissing) {
        try {
            return getFieldValue(path, clazz);
        } catch (IllegalArgumentException e) {
            if (ignoreMissing) {
                return null;
            } else {
                throw e;
            }
        }
    }

Not sure about it, but it would save some code repetition in other processors too.

@@ -39,6 +39,7 @@ public void testCreate() throws Exception {
assertThat(splitProcessor.getTag(), equalTo(processorTag));
assertThat(splitProcessor.getField(), equalTo("field1"));
assertThat(splitProcessor.getSeparator(), equalTo("\\."));
assertThat(splitProcessor.isIgnoreMissing(), equalTo(false));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use assertFalse()

@talevy
Copy link
Contributor Author

talevy commented Nov 10, 2016

@martijnvg mind giving this another look?

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@talevy talevy merged commit 6796464 into elastic:master Nov 16, 2016
talevy added a commit that referenced this pull request Nov 16, 2016
@talevy talevy deleted the fix-20840 branch November 16, 2016 13:48
jasontedor added a commit that referenced this pull request Nov 16, 2016
* master: (22 commits)
  Add proper toString() method to UpdateTask (#21582)
  Fix `InternalEngine#isThrottled` to not always return `false`. (#21592)
  add `ignore_missing` option to SplitProcessor (#20982)
  fix trace_match behavior for when there is only one grok pattern (#21413)
  Remove dead code from GetResponse.java
  Fixes date range query using epoch with timezone (#21542)
  Do not cache term queries. (#21566)
  Updated dynamic mapper section
  Docs: Clarify date_histogram bucket sizes for DST time zones
  Handle release of 5.0.1
  Fix skip reason for stats API parameters test
  Reduce skip version for stats API parameter tests
  Strict level parsing for indices stats
  Remove cluster update task when task times out (#21578)
  [DOCS] Mention "all-fields" mode doesn't search across nested documents
  InternalTestCluster: when restarting a node we should validate the cluster is formed via the node we just restarted
  Fixed bad asciidoc in boolean mapping docs
  Fixed bad asciidoc ID in node stats
  Be strict when parsing values searching for booleans (#21555)
  Fix time zone rounding edge case for DST overlaps
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >enhancement v5.1.1 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants