[Ingest] No match for grok#15132
Conversation
There was a problem hiding this comment.
can you use randomFieldName for the field name so we test inner fields too rather than only top level ones?
There was a problem hiding this comment.
What do you mean "inner fields"? Passing a string "foo.bar" is not the same as creating an object field foo with a property bar.
There was a problem hiding this comment.
I think he means to do something like this
String fieldName = RandomDocumentPicks.randomFieldName(random());
IngestDocument doc = new IngestDocument("index", "type", "id", new HashMap<>());
doc.setFieldValue(fieldName, "1");this way, passing a string "foo.bar" would appropriately be treated as an object path in the context of IngestDocument#setFieldValue, rather than simply doing a put on a normal Map.
There was a problem hiding this comment.
Except that is not how documents come in? Elasticsearch does not allow this; you can't have a field with a dot in the name (since 2.0).
There was a problem hiding this comment.
This is an IngestNode syntax for referencing substructure in the document. For the reason that no field can have dots in the name, we use the dots to represent the object path. It is not setting a field whose key is foo.bar, it is building a document whose structure resembles this:
{
"foo" : {
"bar" : "1"
}
}
There was a problem hiding this comment.
that is what I meant @talevy . @rjernst ingest is a collection of processors that modify a document before it gets indexed through a filter. users will refer to fields within a document using the dot notation. that is fine. we are aware of the fact that es doesn't accept dots within a field name, actually we are relying on this behaviour at this point.
|
left some comments around testing, LGTM otherwise |
|
LGTM2 |
adc6788 to
2c1effd
Compare
|
updated to reflect comments |
|
LGTM |
Throw exception when grok expression does not match