Skip to content

Instantly share code, notes, and snippets.

View hkulekci's full-sized avatar
⛰️
Remote

Haydar KÜLEKCİ hkulekci

⛰️
Remote
View GitHub Profile
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
##
# 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
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

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
; 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 June 23, 2023 11:58
Elasticsearch Nested Array Object Size Aggregation
# images field type is nested
GET products/_search
{
  "track_total_hits": true, 
  "size": 0, 
  "aggs": {
    "counts": {
      "terms": {
 "script": "params['_source']['images'].size()",
@hkulekci
hkulekci / sample_uuid_elasticsearch.java
Created August 13, 2019 18:20
Elasticsearch UUID Generator Part
//*******************************************************************
// Welcome to CompileJava!
// If you experience any issues, please contact us ('More Info') -->
// Sorry that the "Paste" feature no longer works! GitHub broke it.
//*******************************************************************
import java.lang.Math; // headers MUST be above the first class
/*
@hkulekci
hkulekci / trait_example.php
Last active May 15, 2019 09:24
Name Trait Method to Override
<?php
trait A {
public static function dispatch()
{
var_dump(func_get_args());
return new static(...func_get_args());
}
}
@hkulekci
hkulekci / example.md
Created May 2, 2019 12:43
Esalticsearch Example Usage
DELETE demodata


PUT demodata
{
  "mappings": {
    "document": {
      "properties": {
        "documentName": {
@hkulekci
hkulekci / elastic.md
Last active April 26, 2019 12:32
Standard Analyzer Weird Result
########

GET _analyze
{
  "text": ["document.txt"], 
  "analyzer": "standard"
}

{