Skip to content

Instantly share code, notes, and snippets.

View quoeamaster's full-sized avatar

Takara-Mono, Jason quoeamaster

View GitHub Profile
PUT _ingest/pipeline/func_add_last_update_time
{
"version": 1,
"description": "any stage: add back last update timestamp using script approach",
"processors": [
{
"script": {
"lang": "painless",
"source": """
ctx.last_update_time = new Date();
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"dissect": {
"field": "message",
"pattern": "%{user_id}:%{action}:%{action_id}:%{action_ts}:%{description}"
}
},
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"dissect": {
"field": "message",
"pattern": "%{user_id}:%{action}:%{action_id}:%{action_ts}:%{description}"
}
},
PUT _ingest/pipeline/func_convert_age
{
"processors": [
{
"convert": {
"field": "age",
"type": "integer"
}
}
]
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"dissect": {
"field": "message",
"pattern": "%{name}:%{age}"
}
},
{
"docs" : [
{
"doc" : {
"_index" : "_index",
"_type" : "_type",
"_id" : "_id",
"_source" : {
"name" : "helen wong",
"message" : "helen wong:45",
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"dissect": {
"field": "message",
"pattern": "%{name}:%{age}"
}
},
PUT app_log_1
{
"settings": {
"default_pipeline": "add_last_update_time"
}
}
# mappings (tbl_publisher records)
PUT blog_enrich_publisher
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "text",
# mapping (tbl_books)
PUT blog_enrich_books
{
"mappings": {
"properties": {
"pub_id": {
"type": "keyword"
},
"name": {
"type": "text",