Question: I have an elastic search river setup using the jdbc river plugin, that just does a simple select \* from and indexes that table.

But I would like to be able to trigger the river on demand via the API as well as at a standard time interval, so that I can have it index a document when its inserted into this table.

Anybody know if theres anyway to do this at present? 

i.e. 
`/_river/my_river/_refresh`

Thanks.

Answer: 
It sounds like you are struggling with the classic "[push vs. pull](http://elasticsearch-users.115913.n3.nabble.com/keeping-datastore-and-index-in-sync-Push-Vs-Pull-best-approach-td4032591.html)" indexing problem. Rivers are designed to pull data out of the database at an interval. They're easy to set up, but like all things in computer science, they are a trade-off. Specifically, you lose real-time indexing. A river that you can trigger might be the best of both worlds, or it might inundate your server with a lot of unnecessary traffic (i.e. why do "SELECT \* ..." when you know exactly which document was updated?).

If you have a real-time indexing requirement (like I did), you "push" your updates into Elasticsearch. You just need to write an Elasticsearch client that will deliver your updated records to Elasticsearch as they are saved. FWIW, I solved this problem by firing messages on a service bus, and a service waiting on the other end retrieved the entity from SQL and indexed it. Once you have that infrastructure, it's not a big deal to write a small app to do an initial import of SQL data or create a scheduled job to index data.
alernative would be use logstash with jdbc plugin

<https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html>

1. download logstash
2. install input-jdbc-plugin

example config:

```
    input {
            jdbc {
                    jdbc_connection_string => "jdbc:oracle:thin:@localhost:1521:XE"
                    jdbc_user => "user"
                    jdbc_driver_library => "/home/logstash/lib/ojdbc6.jar"
                    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
                    statement => "select * from events where update_date > :sql_last_value order by update_date"
                    last_run_metadata_path => "run_metadata_event.log"
                    schedule => "* * * * *"
                    jdbc_password => "password"
            }
    }
    # The filter part of this file is commented out to indicate that it is
    # optional.
    filter {
           mutate {
                   split => { "field_1" => ";"}

           }
    }

    output {
        elasticsearch {
            #protocol => "http"
            hosts => ["localhost:9200"]
            index => "items"
            document_type => "doc_type"
            document_id => "%{doc_id}"
        }
    }

```