You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streams.apache.org by steveblackmon <gi...@git.apache.org> on 2014/06/26 00:38:39 UTC

[GitHub] incubator-streams pull request: Streams 116

GitHub user steveblackmon opened a pull request:

    https://github.com/apache/incubator-streams/pull/44

    Streams 116

    Resolves STREAMS-116

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

    $ git pull https://github.com/apache/incubator-streams STREAMS-116

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

    https://github.com/apache/incubator-streams/pull/44.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 #44
    
----
commit c73dadd7418bba8e783e9589327029fec4b23970
Author: sblackmon <sb...@w2odigital.com>
Date:   2014-06-24T19:29:19Z

    adding search request source as JSON field in configuration

commit 9582c0cb703f075b218016b0dac2e85708a71d14
Author: sblackmon <sb...@w2odigital.com>
Date:   2014-06-25T18:45:13Z

    better debug logging

commit b1f94a6b7ad9d88ffaf393953b8b246eb41364e1
Author: sblackmon <sb...@w2odigital.com>
Date:   2014-06-25T22:36:48Z

    resolves STREAMS-116
    adding README

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-streams pull request: Streams 116

Posted by steveblackmon <gi...@git.apache.org>.
Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/44#discussion_r14601080
  
    --- Diff: streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchQuery.java ---
    @@ -123,14 +129,34 @@ public void execute(Object o) {
     
             // If we haven't already set up the search, then set up the search.
             if (search == null) {
    +
                 search = elasticsearchClientManager.getClient()
                         .prepareSearch(indexes.toArray(new String[0]))
                         .setSearchType(SearchType.SCAN)
                         .setSize(Objects.firstNonNull(batchSize, DEFAULT_BATCH_SIZE).intValue())
                         .setScroll(Objects.firstNonNull(scrollTimeout, DEFAULT_SCROLL_TIMEOUT));
     
    +            String searchJson;
    +            if( config.getSearch() != null ) {
    +                LOGGER.debug("Have config in Reader: " + config.getSearch().toString());
    +
    +                try {
    +                    searchJson = mapper.writeValueAsString(config.getSearch());
    +                    LOGGER.debug("Setting source: " + searchJson);
    +                    search = search.setExtraSource(searchJson);
    +
    +                } catch (JsonProcessingException e) {
    +                    LOGGER.warn("Could not apply _search supplied by config");
    +                    e.printStackTrace();
    --- End diff --
    
    removed printStackTrace calls


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-streams pull request: Streams 116

Posted by steveblackmon <gi...@git.apache.org>.
Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/44#discussion_r14601047
  
    --- Diff: streams-contrib/streams-persist-elasticsearch/README.md ---
    @@ -0,0 +1,47 @@
    +streams-persist-elasticsearch
    +=====================
    +
    +Read and write to Elasticsearch
    +
    +Example reader configuration:
    +
    +    "elasticsearch": {
    +        "hosts": [
    +            "localhost"
    +        ],
    +        "port": 9300,
    +        "clusterName": "elasticsearch",
    +        "indexes": [
    +            "sourceindex"
    +        ],
    +        "types": [
    +            "sourcetype"
    +        ],
    +        "_search": {
    +            "query" : {
    +                "match_all" : { }
    +            }
    +        }
    +    }
    +
    +Example writer configuration:
    +
    +    "elasticsearch": {
    +        "hosts": [
    +            "localhost"
    +        ],
    +        "port": 9300,
    +        "clusterName": "elasticsearch",
    +        "index": "destinationindex",
    +        "type": "destinationtype
    +    }
    +
    +For more examples, see:
    +
    +- [elasticsearch-backup](http://github.com/w2ogroup/streams-examples/tree/master/elasticsearch-backup)
    --- End diff --
    
    removed example references


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-streams pull request: Streams 116

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-streams/pull/44


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-streams pull request: Streams 116

Posted by mfranklin <gi...@git.apache.org>.
Github user mfranklin commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/44#discussion_r14347250
  
    --- Diff: streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchQuery.java ---
    @@ -123,14 +129,34 @@ public void execute(Object o) {
     
             // If we haven't already set up the search, then set up the search.
             if (search == null) {
    +
                 search = elasticsearchClientManager.getClient()
                         .prepareSearch(indexes.toArray(new String[0]))
                         .setSearchType(SearchType.SCAN)
                         .setSize(Objects.firstNonNull(batchSize, DEFAULT_BATCH_SIZE).intValue())
                         .setScroll(Objects.firstNonNull(scrollTimeout, DEFAULT_SCROLL_TIMEOUT));
     
    +            String searchJson;
    +            if( config.getSearch() != null ) {
    +                LOGGER.debug("Have config in Reader: " + config.getSearch().toString());
    +
    +                try {
    +                    searchJson = mapper.writeValueAsString(config.getSearch());
    +                    LOGGER.debug("Setting source: " + searchJson);
    +                    search = search.setExtraSource(searchJson);
    +
    +                } catch (JsonProcessingException e) {
    +                    LOGGER.warn("Could not apply _search supplied by config");
    +                    e.printStackTrace();
    --- End diff --
    
    pass the exception as the second parameter to LOGGER.warn rather than printing


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-streams pull request: Streams 116

Posted by mfranklin <gi...@git.apache.org>.
Github user mfranklin commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/44#discussion_r14347193
  
    --- Diff: streams-contrib/streams-persist-elasticsearch/README.md ---
    @@ -0,0 +1,47 @@
    +streams-persist-elasticsearch
    +=====================
    +
    +Read and write to Elasticsearch
    +
    +Example reader configuration:
    +
    +    "elasticsearch": {
    +        "hosts": [
    +            "localhost"
    +        ],
    +        "port": 9300,
    +        "clusterName": "elasticsearch",
    +        "indexes": [
    +            "sourceindex"
    +        ],
    +        "types": [
    +            "sourcetype"
    +        ],
    +        "_search": {
    +            "query" : {
    +                "match_all" : { }
    +            }
    +        }
    +    }
    +
    +Example writer configuration:
    +
    +    "elasticsearch": {
    +        "hosts": [
    +            "localhost"
    +        ],
    +        "port": 9300,
    +        "clusterName": "elasticsearch",
    +        "index": "destinationindex",
    +        "type": "destinationtype
    +    }
    +
    +For more examples, see:
    +
    +- [elasticsearch-backup](http://github.com/w2ogroup/streams-examples/tree/master/elasticsearch-backup)
    --- End diff --
    
    We cannot reference an external repo.  These either need to be moved to the website or moved to our repo.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---