ElasticSearch: plugin Phonetic analayzer in rails 4 - plugins

I am trying to implement phonetic plug-in (https://github.com/elasticsearch/elasticsearch-analysis-phonetic) in elastic search.
To implement this plug-in i had refereed the below link
http://blog.jessitron.com/2012/04/configuring-soundex-in-elasticsearch.html
Tested with following steps :
curl localhost:9200/_shutdown -XPOST
curl localhost:9200/anyindexname -XPUT
{"ok":true,"acknowledged":true}
curl "localhost:9200/anyindexname/_analyze?analyzer=search_soundex&pretty=true" -d 'bunch of words'
It throws me an error such as
{
"error" : "ElasticSearchIllegalArgumentException[failed to find analyzer [search_soundex]]",
"status" : 400
}
Guys, I need your help to solve this problem.....

Related

Not able to setup connection.url for kafka connect setup for oracle

I am trying to setup a pipeline to stream data from oracle database and put it into a topic.I connect to this database using below tnsnames.ora file on my local. Please do notice, this database is not on localhost.
tnsnames.ora :
DV06 = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =dev-db.uc.com)(PORT = 5222))
(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = devdbsc.uc.com)))
I am using lensesio/fast-data-dev image for all required Kafka service and running everything under Docker.
Steps to create a connector :
Step 1 :
Identify jar path :
As I am trying to connect to oracle database, First thing I tried to look for Kafka-connect-jdbc* so that I can download and place odbc jar in the same folder.
root#fast-data-dev / $ find / -name kafka-connect-jdbc\*.jar
/opt/landoop/connectors/third-party/kafka-connect-jdbc/kafka-connect-jdbc-5.2.3.jar
root#fast-data-dev / $
Step 2:
Place jar file :
The next step is to download odbc jar and place in same path. I have downloaded it from Maven repository and place it in the same folder: ojdbc8-12-2.0.1.jar
root#fast-data-dev / $ ls opt/landoop/connectors/third-party/kafka-connect-jdbc/
audience-annotations-0.5.0.jar jline-0.9.94.jar mariadb-java-client-2.2.1.jar postgresql-9.4.1212.jar sqlite-jdbc-3.25.2.jar
common-utils-5.2.3.jar jtds-1.3.1.jar netty-3.10.6.Final.jar sample-config zkclient-0.10.jar
doc kafka-connect-jdbc-5.2.3.jar ojdbc8-12-2.0.1.jar slf4j-api-1.7.25.jar zookeeper-3.4.13.jar
root#fast-data-dev / $
Step 3 :
Create connector:
I tried two options with connection.url.
Option 1:
curl -X POST "http://localhost:8083/connectors" -H "Content-type:application/json" --data \
'{
"name" : "orc_source",
"config" : {
"connector.class" : "io.confluent.connect.jdbc.JdbcSourceConnector",
"connection.url" : "jdbc:oracle:thin:#dev-db.uc.com:5222,
"connection.user":"FG",
"connection.password":"1234",
"mode":"bulk",
"topic.prefix": "oracle_",
"table.whitelist":"DRVR_TBL",
"poll.interval.ms":10000
}
}'
Option 2:
curl -X POST "http://localhost:8083/connectors" -H "Content-type:application/json" --data \
'{
"name" : "orc_source",
"config" : {
"connector.class" : "io.confluent.connect.jdbc.JdbcSourceConnector",
"connection.url" : "jdbc:oracle:thin:#dev-db.uc.com:5222/devdbsc.uc.com,
"connection.user":"FG",
"connection.password":"1234",
"mode":"bulk",
"topic.prefix": "oracle_",
"table.whitelist":"DRVR_TBL",
"poll.interval.ms":10000
}
}'
But in both cases, I am getting below error :
"error_code":400,"message":"Connector configuration is invalid and contains the following 2 error(s):\nInvalid value java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:#dev-db.uc.com:5222 for configuration Couldn't open connection to jdbc:oracle:thin:#dev-db.uc.com:5222\nInvalid value java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:#dev-db.uc.com:5222 for configuration Couldn't open connection to jdbc:oracle:thin:#dev-db.uc.com:52221\nYou can also find the above list of errors at
the endpoint `/{connectorType}/config/validate`"}.
It seems like there is some problem the way I am passing the connection.url but not sure where it's going wrong. please suggest.

Jenkins http plugin to upload file using rest

I am trying to upload a file to a rest server from jenkins using http plugin. I have a jenkins pipelie where a step involves loading a file(type formData)
to a server using rest.
the server side method uses two parameters:
(#FormDataParam("file") InputStream file, #FormDataParam("fileName") String fileName)
I am using the below method
def filename = "${WORKSPACE}/Test.txt"
data="""{ \"fileName\" : \"Test.txt\" }"""
resp3 = httpRequest consoleLogResponseBody: true,url: "http://<url>",contentType:'APPLICATION_OCTETSTREAM',customHeaders:[[name:'Authorization', value:"Basic ${auth}"]],httpMode: 'POST',multipartName: 'Test.txt',uploadFile: "${filename}",requestBody:data,validResponseCodes: '200'
but when I run the status code is 400 and in the server logs the message is that no filestream and no filename is received i.e not able to get both the arguments.
Please let me know where it is getting wrong
Regards
You can try using curl instead of built-in Jenkins methods:
curl -XPOST http://<url> -H 'Content-Type: application/octet-stream' -H 'Authorization: Basic ${auth}' --data-binary '{\"fileName\" : \"Test.txt\" }'
You can debug it first from within shell. Once it's working, wrap it in sh directive:
sh "curl ..."
Since I was running on windows so bat + curl worked for me .With this workaround I was able to transfer files using jenkins and rest
However using httpRequest from jenkins inbuild library is still not working.

jfrog cli artifact search by filename pattern

I want to search for a filename pattern across entire JFrog ARM
without knowing the explicit repository name in the JFrog cli.
jfrog rt s "reponame/*pattern*"
is giving the results as expected in a specific repo.
But I have repo1, repo2, repo3, ... so on.
How do I search using wildcard for reponame, below is not working.
jfrog rt s "*/*pattern*"
Basically I want the jfrog cli equlivalent of the curl GET request search
"https://server/artifactory/api/search/artifact?name=*pattern*"
This is not for cli client, but an alternative way to get desired feature. Spent some time looking at API here:
https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API
I recommend to scroll down that page slowly and read in entirety as a lof of possible commands, syntax is excellent, I executed a few searches and they searched all local repositories. No need to recursively search 1 by 1. Command syntax:
export url="http://url/to/articatory"
curl --noproxy '*' -x GET "$url/api/search/artifact?name=log4j*"
Read link above for more granular search options/syntax.
How I set it up:
alias artpost='curl -X POST "http://url/artifactory/api/search/aql" -T - -u admin:password'
Some example usage:
echo 'items.find({"name": {"$match" : "log4j*"}})' | artpost
echo 'items.find({"$and" : [{"created" : {"$gt" : "2017-06-12"}},{"name": {"$nmatch" : "*surefire*"}}]})' | artpost

RESTHeart database create

I am using RESTHeart to access a Mongo database. RESTHeart has a an API that is supposed to create a database, e.g.:
curl -X put http://localhost:8080/db1
Well, I was using a chrome browser-based REST client that happened to do the equivalent of the follow curl call, but I accidentally forgot to nuke the data portion. It contained the JSON {"e":"f"} for data.
curl -X put -H 'Content-Type: application/json' --data-raw '{"e":"f"}' http://localhost:8080/db2`
When I then tried to do a curl get, it returns a value with the key/value pair "e":"f" stuffed in there - which is not what I want.
$ curl http://localhost:8080/db2
... { "_id" : "db2" , "e" : "f" , "_etag" : { "$oid" : "570f90601d956327e8df28c4"} , "_size" : 0 , "_total_pages" : 0 , "_returned" : 0}
Now, using the Mongo shell, I try to find this key/value pair using just about every Mongo shell command. But, I can't find it, nor can I remove it either. In fact, I can create a rather large Mongo database, then do that curl put, and I'm screwed, but it then adds the pair to my nice clean database.
Does anyone know how I can remove that strange key/value pair, either using Mongo shell, or the RESTHeart API - short of nuking the database and recreating it from scratch?! Thanks.
To remove the db property just update the db:
With PATCH:
PATCH /db {"$unset": {"e": null}}
Or with PUT
PUT /db {}
For more info look at the documentation reference sheet and representation format

Track number of download of a release (binaries) on Github

So now you can manage and publish your binaries directly on Github, the feature is back from early this month (source).
I've been looking around Github interface and I haven't seen a download tracker. This is a feature Google Code offer and I was wondering if Github has the same.
Please note, I am not interested to know the number of download of a repo, this is a different topic.
Based on Petros answer, I used the two following curl command:
To get the list of all releases including their id and number of
download:
curl -i https://api.github.com/repos/:owner/:repo/releases -H "Accept: application/vnd.github.manifold-preview+json"
For example to list all the release for the OpenRefine project:
curl -i https://api.github.com/repos/openrefine/openrefine/releases -H "Accept: application/vnd.github.manifold-preview+json"
Then to get details on each release (you will need to run the first query to get the release id)
curl -i https://api.github.com/repos/:owner/:repo/releases/assets/:release_id -H "Accept: application/vnd.github.manifold-preview+json"
With the same example to list the details including download number for google-refine-2.5-r2407.zip
curl -i https://api.github.com/repos/openrefine/openrefine/releases/assets/6513 -H "Accept: application/vnd.github.manifold-preview+json"
You can use the GitHub API to get the download_count among other things for a single release asset:
http://developer.github.com/v3/repos/releases/#get-a-single-release-asset
This is how it looks currently, but please check the link above just in case anything changed since this answer was written.
GET /repos/:owner/:repo/releases/assets/:id
{
"url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
"id": 1,
"name": "example.zip",
"label": "short description",
"state": "uploaded",
"content_type": "application/zip",
"size": 1024,
"download_count": 42,
"created_at": "2013-02-27T19:35:32Z",
"updated_at": "2013-02-27T19:35:32Z"
}
You can add a badge to your github repo. See this answer for more details.
Also, there is a nifty project that shows all of this data in a nice website which is over here: https://www.somsubhra.com/github-release-stats/