This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET "http://localhost:9200/seasonalfoods/_search/template" -d' | |
{ | |
"template": { | |
"query": { | |
"match": { | |
"ingredients": "{{ingredientsParam}}" | |
} | |
} | |
}, | |
"params": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ([Parameter(Mandatory=$true)][string]$query) | |
$con = New-Object -TypeName System.Data.OleDb.OleDbConnection | |
$con.ConnectionString = "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';" | |
$con.Open() | |
$cmd = $con.CreateCommand() | |
$query = "SELECT Top 5 System.ItemPathDisplay FROM SYSTEMINDEX WHERE contains(*, '$($query)*') AND System.Kind = 'email'" | |
$cmd.CommandText = $query | |
$rdr = $cmd.ExecuteReader() | |
while ($rdr.Read()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export ELASTICSEARCH_ENDPOINT="http://localhost:9200" | |
# Create indexes | |
curl -XPUT "$ELASTICSEARCH_ENDPOINT/play" -d '{ | |
"settings": { | |
"analysis": { | |
"analyzer": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text: This text will be used if nothing else is specified. | |
analyzer: | |
myAnalyzer: | |
type: custom | |
tokenizer: whitespace | |
filter: | |
- lowercase | |
- reverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST "http://localhost:9200/seasonalfoods/_search" -d' | |
{ | |
"size": 0, | |
"aggs": { | |
"ingredients": { | |
"filter": { "terms": { | |
"ingredients": [ | |
"jordbær", | |
"rips", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST "http://localhost:9200/seasonalfoods/_search" -d' | |
{ "explain":true, | |
"query": { | |
"terms": { | |
"ingredients": [ | |
"jordbær", | |
"bringebær", | |
"rips", | |
"solbær", | |
"stikkelsbær", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text: This text will be used if nothing else is specified. | |
analyzer: | |
myAnalyzer: | |
type: custom | |
tokenizer: whitespace | |
filter: | |
- lowercase | |
- reverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- data http://www.vinmonopolet.no/api/produkter | |
-- beskrivelse http://vertical.vinmonopolet.no/vmp/om-vinmonopolet/datadeling/_attachment/434521?_ts=1468fb68128 | |
-- prepare the downloaded data by replacing Norwegian numeric separator , with . (using this regex:(\d),(\d) replace:\1.\2 | |
-- In my csv file there was a lonely double quote, that had to be manually deleted | |
--DROP DATABASE "vinmonopolet"; | |
CREATE DATABASE "vinmonopolet"; | |
\connect vinmonopolet postgres |
We can't make this file beautiful and searchable because it's too large.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Datotid;Varenummer;Varenavn;Volum;Pris;Literpris;Varetype;Produktutvalg;Butikkategori;Fylde;Friskhet;Garvestoffer;Bitterhet;Sodme;Farge;Lukt;Smak;Passertil01;Passertil02;Passertil03;Land;Distrikt;Underdistrikt;Argang;Rastoff;Metode;Alkohol;Sukker;Syre;Lagringsgrad;Produsent;Grossist;Distributor;Emballasjetype;Korktype;Vareurl | |
2015-02-02T00:21:16;1101;L�iten Linie;0.70;399.90;571.30;Akevitt;Basisutvalget;Butikkategori 3;0;0;0;0;0;;;;;;;Norge;�vrige;�vrige;;Poteter, krydder;16 mnd p� fat;41.50;5.00;Ukjent;;;Arcus AS;Vectura AS;Engangsflasker av glass;;http://www.vinmonopolet.no/vareutvalg/varedetaljer/sku-1101 | |
;1102;L�iten Linie;0.35;239.90;685.40;Akevitt;Basisutvalget;Butikkategori 3;0;0;0;0;0;;;;;;;Norge;�vrige;�vrige;;Poteter, krydder;Lagret 16 md. p� fat.;41.50;5.00;Ukjent;;;Arcus AS;Vectura AS;Engangsflasker av glass;;http://www.vinmonopolet.no/vareutvalg/varedetaljer/sku-1102 | |
;1201;Gilde Non Plus Ultra;0.70;599.90;857.00;Akevitt;Bestillingsutvalget;Uavhengig sortiment;0;0;0;0;0;Middels dyp gyllengul.;Arom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-PSVersion { | |
if (test-path variable:psversiontable) {$psversiontable.psversion} else {[version]"1.0.0.0"} | |
} | |
$powershell = Get-PSVersion | |
if($powershell.Major -le 2 ){ | |
Write-Error "Oh, so sorry, this script requires Powershell 3 (due to convertto-json)" | |
exit | |
} |
OlderNewer