Skip to content

Instantly share code, notes, and snippets.

View sebnmuller's full-sized avatar

Sébastien Muller sebnmuller

View GitHub Profile
@sebnmuller
sebnmuller / logstash.conf
Created December 13, 2016 20:09
Logstash Elasticsearch Template
input {
file {
path => "/Users/sebastienmuller/dev/elastic/5/logstash-5.0.2/bin/produkter.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => plain { charset => "ISO-8859-1" }
}
#stdin {}
}
@sebnmuller
sebnmuller / solr-filter.conf
Last active May 10, 2021 18:37
Logstash config for ingesting Solr logs
input {
file {
path => "/Users/sebastienmuller/comperio/projects/sintef/tmp/logs/indexing_logs_2/solr.log.3"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
# Extract event severity and timestamp
@sebnmuller
sebnmuller / select
Last active August 29, 2015 14:19
Solrconfig spellcheck configuration
<requestHandler name="/select" class="solr.SearchHandler">
<!-- default values for query parameters can be specified, these
will be overridden by parameters in the request
-->
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="spellcheck">on</str>
<str name="spellcheck.dictionary">default</str>
<str name="spellcheck.collate">true</str>
@sebnmuller
sebnmuller / logstashconf
Created March 20, 2015 09:31
Logstash Conf for Posten
input {
file {
codec => "json"
path => ["/Users/sebastienmuller/comperio/projects/posten/tmp/query.log"]
}
}
output {
elasticsearch {
index => "posten_logs"
@sebnmuller
sebnmuller / SRBExample
Last active August 29, 2015 14:17
Example Elasticsearch SearchRequestBuilder
// Use our autowired searchService to instantiate an Elasticsearch client
Client client = searchService.elasticsearchClient(host, 9300);
// Initialise our SRB
SearchRequestBuilder srb = searchService.elasticsearchSearchRequestBuilder(client, index);
// Add aggregations to the srb
srb.addAggregation(AggregationBuilders.terms("shop").field("shop").size(20));
// Create our filtered query and add it to the srb
FilterBuilder fb = elasticsearchResultFunctions.gteDateRangeFilter("valid_to", DateTime.now());
@sebnmuller
sebnmuller / RecursiveMergeExistingDocFactory
Created January 16, 2015 09:46
RecursiveMergeExistingDocFactory
<!-- Retrieve existing leaf document contents -->
<processor class="no.comperio.solr.update.processors.RecursiveMergeExistingDocFactory" >
<str name="solrUrl">http://localhost:18080/solr</str>
<str name="localIdField">content_s</str>
<str name="foreignIdField">pageid</str>
<lst name="foreignSourceFieldList">
<str name="text_s">text_ss</str>
<str name="address_s">address_ss</str>
<str name="title">content_ss</str>
<str name="content">content_ss</str>
@sebnmuller
sebnmuller / delta
Last active August 29, 2015 14:05
Retrieve changes in database since last index
00 23 * * * curl "http://localhost:8983/solr/dataimport?command=delta-import&optimize=false"
@sebnmuller
sebnmuller / solr-http
Last active August 29, 2015 14:05
Useful Solr HTTP requests
Clear index: http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true
Retrieve all: http://localhost:8983/solr/select?q=*:*&omitHeader=true
Index db: http://localhost:8983/solr/collection1/dataimport?command=full-import
Reload core: http://localhost:8983/solr/admin/cores?action=RELOAD&core=collection1
Georgi query: http://localhost:8983/solr/select?q=georgi&wt=json&qf=first_name%20last_name&defType=edismax
@sebnmuller
sebnmuller / postman-solr
Created August 28, 2014 07:55
Postman collection with various useful Solr HTTP requests
{"version":1,"collections":[{"id":"04bbd880-89d1-6b8e-493b-3a5897c3a627","name":"Solr","timestamp":1408609487361,"order":["1318faeb-455d-5933-04aa-03497ef65620","a586f9c9-924f-9e94-4adf-63b656d65ce3","20459ac6-9805-280c-aaef-18b9dcc27a66","ce6d7ede-ddac-d58b-b479-2c6378d5e815","45e38352-938e-6f6b-0daf-d7603f307d3d","2df3df54-f7a3-4807-80b3-7ce8cfcae45d","2ae918e7-8c7e-34af-a67b-404b57d6b403","1c16e9c1-20f5-b102-a8f2-530cfaa7616e","3b6052b6-e184-2613-f114-ef317bc8a179"],"requests":[{"collectionId":"04bbd880-89d1-6b8e-493b-3a5897c3a627","id":"1318faeb-455d-5933-04aa-03497ef65620","name":"Add to index multiple","description":"Add multiple documents to the index","url":"http://localhost:8983/solr/update/json?wt=json","method":"POST","headers":"Content-Type: text/json\n","data":"{\n\"add\": {\n\t\"doc\" : {\n\t\t\"id\":\"1\",\n\t\t\"first_name\":\"christopher\",\n \"last_name\":\"walkin\"\n\t}\n},\n\"add\": {\n\t\"doc\" : {\n\t\t\"id\":\"2\",\n\t\t\"first_name\":\"kristoffer\",\n \"last_name\":\"runn
@sebnmuller
sebnmuller / db-data-config
Last active February 11, 2016 09:22
Connection config for indexing a database to Solr
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/employees"
user="user"
password="password" />
<document>
<entity name="id" query="select emp_no as 'id', first_name, last_name from employees limit 1000;" />
</document>
</dataConfig>