Skip to content

Instantly share code, notes, and snippets.

View hkulekci's full-sized avatar
⛰️
Remote

Haydar KÜLEKCİ hkulekci

⛰️
Remote
View GitHub Profile
@hkulekci
hkulekci / terms_set_query.md
Last active September 9, 2023 09:00
terms_set Query
View terms_set_query.md
DELETE job-candidates

PUT job-candidates
{
  "mappings": {
    "properties": {
      "name": {
        "type": "keyword"
      },
@hkulekci
hkulekci / percolator.md
Last active September 9, 2023 04:53
Percolator Field with Nested Query
View percolator.md
PUT testindex1
{
  "mappings": {
    "properties": {
      "search": {
        "properties": {
          "query": { 
            "type": "percolator" 
          }
@hkulekci
hkulekci / sample.md
Created June 28, 2023 14:08
Some Sample Data
View sample.md
The clear, refreshing taste of tap water quenches my thirst on hot summer days.
Please make sure to filter the tap water before drinking it.
The tap in the kitchen was leaking, causing the water to drip incessantly.
After a long hike, we refilled our water bottles with tap water from the nearby fountain.
It's important to conserve tap water and use it wisely to protect our natural resources.
The tap water in this area has a slightly metallic taste, which can be off-putting to some people.
The plumber fixed the broken tap, ensuring a steady flow of water throughout the house.
My grandma always used to boil tap water before using it in cooking or drinking.
The city council implemented a new filtration system to improve the quality of tap water.
@hkulekci
hkulekci / kinesis.py
Last active April 29, 2023 08:04
Kinesis Queue Check
View kinesis.py
import boto3
def check_kinesis_stream_data(stream_name):
# Create a Kinesis client using your AWS credentials
kinesis_client = boto3.client('kinesis')
# Get the shard iterator for the specified stream
shard_response = kinesis_client.describe_stream(StreamName=stream_name)
shard_id = shard_response['StreamDescription']['Shards'][0]['ShardId']
shard_iterator_response = kinesis_client.get_shard_iterator(
@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