I just able to search to my index using below query
xx:9200/myindex/_search?q=keyword
for above search i can able to get results .. how to do another dynamic value in the url and search into particular field dynamically
example : status = 'active' or status = 'dynamic_query_string' ...
so i can able to filter my search result with another field ..
i am using jdbc input and output in logstash
So you make the query using the elasticsearch filter ? You can make %{fieldname}
references in most plugin options, so something like this should work if you have a field named dynamic_status_string
:
filter {
elasticsearch {
...
query => "status:%{dynamic_status_string}"
}
}
hi correct me if i am wrong
from your suggestion
yes i am using elasticsearch filter plugin ,
i am using mysql jdbc .. so my db field name is "status" and it is varchar .. i want to get all search results which status is "active" ..
how to pass the dynamic value "active" while searching using below url
xyz:9200/myindex/_search?q=xyz...
should i pass like below url ?
xyz:9200/myindex/_search?q=xyz&status_param=active
and in logstash filter
filter {
elasticsearch {
...
query => "status:%{status_param}"
}
}
will this work ? or something else
If the status_param
field contains the name of the status you want the filter to find then status:%{statusparam}
is a good query.
Dear Magnus and Aravinthan. I have read all in above but I can not understand one thing.
In my db config I have code look like this
jdbc {
jdbc_connection_string => "jdbc:mysql//localhost:3306/mydb"
jdbc_user => "root"
jdbc_password => ""
jdbc_driver_library => "C:/servers/elasticsearch/con.mysql.jdbc_5.1.5.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
parameters => { "like" => "Beethoven" }
statement => "Select* from users where name = :like"
}
This statement is test and my goal will be very larg sql with more than 4-5 join with dynamic columns and values, Please help me ? Can I pass this parameters dynamicly. For example I am using Elasticsearch PHP Client library.
Thanks
Yuri
@Yur_Gasparyan, please start a new thread for your question. When you do, please clarify exactly what you mean by "pass these parameters dynamically".