[ 
https://issues.apache.org/jira/browse/METRON-1762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16599334#comment-16599334
 ] 

ASF GitHub Bot commented on METRON-1762:
----------------------------------------

GitHub user merrimanr opened a pull request:

    https://github.com/apache/metron/pull/1181

    METRON-1762: Change default Elasticsearch field rename behavior to NOOP

    ## Contributor Comments
    This PR changes the default field renaming behavior in the 
ElasticsearchWriter to NOOP.  Metron uses '.' characters in field names by 
default so this means the separator in ES field names is changed from ':' to 
'.'.  While the this specific change was simple, it cascaded to several 
different parts of the code base.  This is the reason for the rather large PR.
    
    One important implication I would like to point out is that changing field 
names to '.'s causes ES to interpret them as object field types.  There are 
various places in this PR where I had to account for that and is something 
reviewers should keep in mind while testing.  This is a fairly significant 
change and it makes me a little nervous.
    
    ### Changes Included
    - Change the FieldNameConverter to default to NOOP instead of DEDOT
    - Updated constants (MetaAlertConstants.THREAT_FIELD_DEFAULT, etc) to use 
'.'s
    - Changed the legacy `source:type` field to `metron_sensor_type`.  I was 
not able to change it to `source.type` because the bro template defines a 
`source` field.  ES does not allow this (see my object field type comment 
above):  
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/dots-in-names.html#_upgrading_fields_with_dots_to_5_x.
  The `metron_sensor_type` is similar to other dedicated fields like 
`metron_alert` so it made sense to me.  There is really no reason we need to 
have a separate in that field name anyways.
    - Change fields in tests and test data to use '.' instead.  I only changed 
this in tests that were failing so there still may be tests with ':' in field 
names.
    - Changed the field names in the alerts UI code to use '.' instead of ':' 
and also made the `metron_sensor_type` change.  I tried to replace hard-coded 
field names with constants where appropriate to make this easier in the future 
(hopefully we never have to do this again).
    - Updated ES templates to use the new field name conventions and updated 
Solr schemas to use the new `source.type` name.  ES dynamic templates also 
required a switch from the `match` attribute to `path_match` (see my object 
field type comment above).
    - I had to significantly change the ElasticsearchColumnMetadataDao class to 
pull field names out of the column metadata response recursively since they are 
now nested (see my object field type comment above).  For example, without this 
change `threat.triage.score` would be returned only as `threat` because there 
are other field names that start with `threat.triage.*`.  I also updated 
ElasticsearchSearchIntegrationTest to test for this case.
    - Updated the global config `source.type.field` and 
`threat.triage.score.field` settings to match the new field names.  These 
settings are probably useless now.
    - Updated the Solr README by removing some steps that are now unnecessary 
for enabling Solr in Metron.
    
    ### Testing
    I am still working my way through testing.  I have run several tests in 
full dev including:
    
    - Verified data in bro and snort indexes looks correct.
    - Verified the basic features in the alerts UI still work.  This includes 
all fields showing up and being able to filter on the fields that were updated 
to follow the new naming format.
    - Verified the column metadata REST endpoint returns fields and types as 
expected.  As a bonus, dynamic fields that have been indexed are now returned 
with the correct type (I don't think this worked before).
    - Verified the metaalert feature still works correctly
    - Verified switching to Solr works as expected and performing the tests 
listed above
    
    I'm sure there are test cases I'm missing since this is change cuts across 
so many parts of Metron.  Still trying to think of more but feel free to add to 
this list.
    
    ### Next Steps
    There are a couple outstanding items and unfinished tasks:
    
    - I only updated the Solr README.  There are several places in our READMEs 
that reference fields with the ':' separator.  Is it worth updating our docs to 
reflect the changes to our field names?  I am still looking through the READMEs 
for spots that obviously need updating (related to `metron_sensor_type` 
specifically).
    - The change to the `metron_sensor_type` field name is reflected in the UI. 
 Is this ok?
    - Should we review and update field names in all tests, even unit tests 
where the actual field name isn't crucial?
    
    Thanks in advance for reviewing this beast.  Hopefully the complexity and 
size of this PR is worth the benefits it offers.
    
    ## Pull Request Checklist
    
    Thank you for submitting a contribution to Apache Metron.  
    Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
    Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 for complete smoke testing guides.  
    
    
    In order to streamline the review of the contribution we ask you follow 
these guidelines and ask you to double check the following:
    
    ### For all changes:
    - [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
    - [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
    - [x] Has your PR been rebased against the latest commit within the target 
branch (typically master)?
    
    
    ### For code changes:
    - [x] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
    - [x] Have you included steps or a guide to how the change may be verified 
and tested manually?
    - [x] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via:
      ```
      mvn -q clean integration-test install && 
dev-utilities/build-utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to 
verify your changes?
    - [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
    - [] Have you verified the basic functionality of the build by building and 
running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [] Have you ensured that format looks appropriate for the output in which 
it is rendered by building and verifying the site-book? If not then run the 
following commands and the verify changes via 
`site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up 
for your personal repository such that your branches are built there before 
submitting a pull request.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/merrimanr/incubator-metron METRON-1762

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/1181.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1181
    
----
commit c9d5876b75709dd8be12f6823123d15c14231b14
Author: merrimanr <merrimanr@...>
Date:   2018-08-31T21:06:15Z

    initial commit

commit d3befc1c5cb0fdccb7577956ecc5ae2b1ba0b62f
Author: merrimanr <merrimanr@...>
Date:   2018-08-31T21:13:49Z

    removed unnecessary steps to enable solr

----


> Change default Elasticsearch field rename behavior to NOOP
> ----------------------------------------------------------
>
>                 Key: METRON-1762
>                 URL: https://issues.apache.org/jira/browse/METRON-1762
>             Project: Metron
>          Issue Type: Improvement
>            Reporter: Ryan Merriman
>            Assignee: Ryan Merriman
>            Priority: Major
>
> Now that our version of ES supports '.' characters in field names, we should 
> change the default behavior of the indexing topology to NOT rename fields 
> with ':' characters.  This will make it consistent with the format of data in 
> other stores (HDFS, Solr, etc).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to