Skip to content

Instantly share code, notes, and snippets.

Avatar
⛰️
Remote

Haydar KÜLEKCİ hkulekci

⛰️
Remote
View GitHub Profile
@hkulekci
hkulekci / 01.md
Created December 11, 2022 06:21
Long named Aggregation test
View 01.md
GET idx_test/_search
{
  "size": 0,
  "aggs": {
    "Lorem-ipsum-dolor-sit-amet--consectetur-adipiscing-elit--Fusce-lacinia-lacus-dignissim--sollicitudin-est-a--rhoncus-velit--Nulla-ut-tortor-at-diam-suscipit-vestibulum--Praesent-dignissim--tellus-sed-tempus-scelerisque--velit-ligula-vestibulum-ante--non-sodales-risus-elit-at-orci--Morbi-at-lectus-quam--Vivamus-mattis--enim-eget-congue-viverra--nulla-dui-fermentum-tortor--nec-scelerisque-libero-tortor-luctus-nisl--Pellentesque-vel-metus-venenatis--gravida-libero-feugiat--tincidunt-ligula-pharetra-Lorem-ipsum-dolor-sit-amet--consectetur-adipiscing-elit--Fusce-lacinia-lacus-dignissim--sollicitudin-est-a--rhoncus-velit--Nulla-ut-tortor-at-diam-suscipit-vestibulum--Praesent-dignissim--tellus-sed-tempus-scelerisque--velit-ligula-vestibulum-ante--non-sodales-risus-elit-at-orci--Morbi-at-lectus-quam--Vivamus-mattis--enim-eget-congue-viverra--nulla-dui-fermentum-tortor--nec-scelerisque-libero-tortor-luctus-nisl--Pellentesque-vel-metus-venenatis--gravida-libero-fe
@hkulekci
hkulekci / nginx-kibana.conf
Last active October 19, 2022 05:52 — forked from dmajorel/nginx-kibana.conf
Nginx configuration for Kibana-ElasticSearch read-only/read-write access
View nginx-kibana.conf
upstream elasticsearch_upstream {
server 10.10.10.10:9200;
keepalive 15;
}
upstream kibana_upstream {
server 127.0.0.1:5601;
}
# Kibana, public access, RO operations
@hkulekci
hkulekci / test.rs
Created July 12, 2022 07:32
What is the mean of "value borrowed here after move"
View test.rs
pub fn run() {
// Correct One
let hello1 = "Hello";
let mut hello2 = String::from("Hello");
hello2.push('\u{1f600}');
println!("{}", hello1.len());
println!("{}", hello2.len());
println!("{:?}", (hello1, hello2));
}
@hkulekci
hkulekci / percentiles_aggregation.md
Created May 27, 2022 08:04
percentiles aggregation
View percentiles_aggregation.md
POST test_index/_bulk
{"index": {"_id": 1}}
{"price": 68}
{"index": {"_id": 2}}
{"price": 74}
{"index": {"_id": 3}}
{"price": 74}
{"index": {"_id": 4}}
{"price": 118}
View sample-data-for-stackoverflow.md
PUT transactions

POST transactions/_bulk
{"index": {"_id": 1}}
{"id": 1, "user_id": 5, "transaction_date": "2022-05-04T11:18:00Z"}
{"index": {"_id": 2}}
{"id": 2, "user_id": 5, "transaction_date": "2022-05-04T10:36:00Z"}
{"index": {"_id": 3}}
{"id": 3, "user_id": 3, "transaction_date": "2022-05-04T10:23:00Z"}
@hkulekci
hkulekci / elastic_bulk-import-settings.sh
Created November 9, 2021 18:26 — forked from fitz123/elastic_bulk-import-settings.sh
Elastic | Performance tuning for big data import
View elastic_bulk-import-settings.sh
##
# Temporary Speed-up configuration for fast import
# references: https://www.elastic.co/blog/performance-considerations-elasticsearch-indexing
# p.s. If you do not want to restart your node/cluster - don't perform 1 and 2 points
##
# 1. Change "ES_HEAP_SIZE" from 50% of memory (default and recommended) to something like 80%
mem=`free -m | grep Mem | awk '{ print $2 }'` && heap=$[ ($mem/1024)*80/100 ]g && \
sudo sed -i "s/ES_HEAP_SIZE=.*/ES_HEAP_SIZE=$heap/" /etc/init.d/elasticsearch
@hkulekci
hkulekci / search_as_you_type
Created March 15, 2021 21:57 — forked from xeraa/search_as_you_type
Elasticsearch's search_as_you_type and completion suggester fields in action
View search_as_you_type
PUT jobs
{
"mappings": {
"properties": {
"title": {
"type": "search_as_you_type"
}
}
}
}
@hkulekci
hkulekci / 0-README.md
Created April 27, 2020 11:20
Turkish Stemmer PHP Test
View 0-README.md

Sample Usage For the PHP Turkish Stemmer Project

You can download the gist as zip and open it. After open it, run the below command:

composer install

Then our environment ready. Just run the file :

@hkulekci
hkulekci / php7.0-fpm-pool-www.conf
Last active August 1, 2020 15:42
PHP FPM www configuration example for a little server
View php7.0-fpm-pool-www.conf
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
@hkulekci
hkulekci / size.md
Last active November 18, 2022 04:47
Elasticsearch Nested Array Object Size Aggregation
View size.md
# images field type is nested
GET products/_search
{
  "track_total_hits": true, 
  "size": 0, 
  "aggs": {
    "counts": {
      "terms": {
 "script": "params['_source']['images'].size()",