Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Bash by JavierBmrg ( 8 years ago )
#!/usr/bin/env bash
# Simple script para testear el funcionamiento de la búsqueda en la instancia ES - Acclink
# Created by Edward Fernández
HOST="localhost";
PORT=19200;
SP_INDEX="acclink-service-provider";
CLIENT_INDEX="acclink-client";
allSp()
{
allSp=`curl -s -XGET $HOST:$PORT/$SP_INDEX/_search?pretty -H 'Content-Type: application/json'` && return "$allSp";
}
allClients()
{
allClient=`curl -s -XGET $HOST:$PORT/$CLIENT_INDEX/_search?pretty -H 'Content-Type: application/json'` && return "$allClient";
}
searchByNames()
{
byNames=`curl -s -XGET $HOST:$PORT/_search?pretty -H 'Content-Type: application/json' -d'
{
"query": {
"multi_match" : {
"query": "Elastic",
"fields": [ "nameClicked", "name" ]
}
}
}
'` && return "$byNames";
}
searchBySkills()
{
bySkills=`curl -s -XGET $HOST:$PORT/_search?pretty -H 'Content-Type: application/json' -d'
{
"query": {
"multi_match" : {
"query": "Php",
"fields": [ "skills.name" ]
}
}
}
'` && return "$bySkills";
}
searchByIndustries()
{
byIndustries=$(curl -s -XGET $HOST:$PORT/_search?pretty -H 'Content-Type: application/json' -d'
{
"query": {
"multi_match" : {
"query": "Aut",
"fields": [ "industries.name" ]
}
}
}
') && return "$byIndustries";
}
searchByRegions()
{
byRegions=$(curl -s -XGET $HOST:$PORT/_search?pretty -H 'Content-Type: application/json' -d'
{
"query": {
"bool": {
"must": [
{ "match": { "regions": "America" }}
]
}
}
}
') && return "$byRegions";
}
run()
{
case $1 in
"allSp")
allSp;
;;
"allClients")
allClients;
;;
"searchByNames")
searchByNames;
;;
"searchBySkills")
searchBySkills;
;;
"searchByIndustries")
searchByIndustries;
;;
"searchByRegions")
searchByRegions;
;;
*)
echo "It must be indicate an available param!\n Available options: allSp, allClients, searchByNames, searchBySkills, searchByIndustries, searchByRegions"
;;
esac
}
run $1;
Revise this Paste