Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
radu-gheorghe / rsyslog compile error
Created August 26, 2014 14:30
rsyslog compile error
msg.c: In function 'getJSONPropVal':
msg.c:2736:3: warning: 'json_object_object_get' is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
field = json_object_object_get(parent, (char*)leaf);
^
msg.c: In function 'msgGetJSONPropJSON':
msg.c:2789:2: warning: 'json_object_object_get' is deprecated (declared at /usr/include/json/json_object.h:217) [-Wdeprecated-declarations]
*pjson = json_object_object_get(parent, (char*)leaf);
^
In file included from /usr/include/json/linkhash.h:16:0,
from /usr/include/json/json.h:22,
@radu-gheorghe
radu-gheorghe / boost_by_id.json
Created August 20, 2014 10:02
boost specific titles
{
"query": {
"function_score": {
"query": {
"multi_match": {
"query": "gospel",
"fields": [
"title.raw^60",
"authors.raw^40",
"subjects.raw^20",
@radu-gheorghe
radu-gheorghe / nested filter
Created August 20, 2014 09:43
nested query turned filter
{
"size": 100,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "gospel",
"fields": [
"title.raw^60",
"authors.raw^40",
@radu-gheorghe
radu-gheorghe / delete_by_query_stats.sh
Created April 14, 2014 10:50
deleted stats are not updated when running delete by query in Elasticsearch 1.1.0
#!/bin/sh
echo
echo '==========================='
echo 'Creating an empty index'
echo '==========================='
curl -XDELETE localhost:9200/test
curl -XPOST localhost:9200/test/ -d '{"settings": {"index.number_of_shards": 1}}'
echo
@radu-gheorghe
radu-gheorghe / test-logsene
Created September 24, 2013 15:40
Logsene test dashboard
{
"title": "another test application",
"services": {
"query": {
"idQueue": [
2,
3,
4
],
"list": {
@radu-gheorghe
radu-gheorghe / match_array.bash
Created July 15, 2013 14:15
match query on an array
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"number_of_shards": 1
}
}'
curl -XPUT localhost:9200/test/test/1 -d '{
"tags": "foo"
}'
curl -XPUT localhost:9200/test/test/2 -d '{
@radu-gheorghe
radu-gheorghe / sharp_search.sh
Created July 10, 2013 08:43
index and search for a value containing #
curl -XDELETE localhost:9200/test1
curl -XPUT localhost:9200/test1
curl -XPUT localhost:9200/test1/test/_mapping -d '{
"test": {
"properties": {
"foo": {
"type": "string",
"index": "not_analyzed"
}
}
@radu-gheorghe
radu-gheorghe / id_path_overwrite.sh
Created July 10, 2013 08:15
Elasticsearch: If you create a mapping with the ID field pointing to a certain path, inserting two docs with the same ID should overwrite, instead of throwing an error. Unless you specify to "create" documents
#!/bin/bash
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/test/_mapping -d '{
"test": {
"_id": {
"path": "foo"
}
}
@radu-gheorghe
radu-gheorghe / track_scores.bash
Created April 28, 2013 09:00
Elasticsearch should still show scores for each hit when sorting on a field and track_scores is true
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test/test/1 -d '{"foo": "bar"}'
curl -XPOST localhost:9200/test/_refresh
echo
echo "==============="
echo -e "\e[00;32mCORRECT: SCORE IS SHOWN WHEN SORTING ON SCORE\e[00m"
echo "==============="
curl 'localhost:9200/test/test/_search?q=bar&pretty' 2>/dev/null | grep score
echo
echo "==============="
@radu-gheorghe
radu-gheorghe / multiple_child_levels.bash
Created April 23, 2013 09:04
multiple parent-child level query with Elasticsearch
curl -XDELETE localhost:9200/test/
curl -XPUT localhost:9200/test/
curl -XPUT localhost:9200/test/son/_mapping -d '{
"son": {
"_parent": {
"type": "mother"
}
}
}'
curl -XPUT localhost:9200/test/daughter/_mapping -d '{