json 维修SOCODA ELK

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json 维修SOCODA ELK相关的知识,希望对你有一定的参考价值。

#CLEAN TAXO DUPES {

#FIND DUPES
POST pimalion.socoda.staging.1087.taxonomy/_search
{
  "size": 0, 
  "aggs": {
    "NAME": {
      "terms": {
        "field": "path.keyword",
        "size": 10000,
        "min_doc_count": 2
      }
    }
  }
}

#GET TAXO BY PATH
POST pimalion.socoda.staging.1087.taxonomy/_search
{
  "size": 0, 
  "query": {
    "term": {
      "path.keyword": {
        "value": "SANITAIRE - CHAUFFAGE/PLOMBERIE/ROBINETTERIE DU BATIMENT/ACCESSOIRES"
      }
    }
  },
  "aggs": {
    "CODES": {
      "terms": {
        "field": "taxonomyCode",
        "size": 10
      }
    },
    "IDS": {
      "terms": {
        "field": "_id",
        "size": 10
      }
    }
  }
}


#CHECK PRODUCTS ATTACHED TO which taxo
POST pimalion.socoda.staging.1087.dzjemproduct/_search
{
  "aggs": {
    "NAME": {
      "terms": {
        "field": "taxonomyCode",
        "size": 10
      }
    }
  }, 
  "size": 0, 
  "query": {
    "term": {
      "pimTaxonomyPath": {
        "value": "ELECTRICITE/APPAREILLAGE & PROTECTION HABITAT ET TERTIAIRE/APPAREILLAGES TERMINAUX/APPAREILLAGE COMPOSABLE RESIDENTIEL"
      }
    }
  }
}

#DELETE The NON USED TAXO

POST pimalion.socoda.staging.1087.taxonomy/_delete_by_query
{
  "query": {
    "term": {
      "id.keyword": {
        "value": "SA_6/2/2/5"
      }
    }
  }
}



#} CLEAN TAXO DUPES
POST pimalion.demo.1088.dzjemproduct/_update_by_query
{
  "script": {
    "source": "for(s in ctx._source.attributes){ s.value = s.value.replace('<h2>', '<h3>').replace('</h2>', '</h3>').replace('<h1>', '<h3>').replace('</h1>', '</h3>').replace('<h4>', '<h3>').replace('</h4>', '</h3>').replace('<div>', '<br>').replace('</div>', '').replace('<p>', '<br>').replace('</p>', '').replace('<b>', '<strong>').replace('</b>', '</strong>').replace('<a>', '<link>').replace('</a>', '</link>').replace(' <br>', '<br>').replace('<br> ', '<br>').replace(' <br/>', '<br>').replace('<br/> ', '<br>').replace('<br/>', '<br>').replace('<ul></ul>', '<br>').replace('<br></', '</').replace('<br><br>', '<br>') }",
    "lang": "painless"
  },
  "query": {
    "match_all": {}
  }
}

#
.replace('<h2>', '<h3>')
.replace('</h2>', '</h3>')
.replace('<h1>', '<h3>')
.replace('</h1>', '</h3>')
.replace('<h4>', '<h3>')
.replace('</h4>', '</h3>')

.replace('<div>', '<br>')
.replace('</div>', '')
.replace('<p>', '<br>')
.replace('</p>', '')
.replace('<b>', '<strong>')
.replace('</b>', '</strong>')
.replace('<a>', '<link>')
.replace('</a>', '</link>')
.replace(' <br>', '<br>')
.replace('<br> ', '<br>')

 <div> => <br>
 </div> => rien
 <p> => <br/>
 </p> => rien
 <b> => <strong>
 </b> => </strong>
 <a> => rien
 </a> => rien
  <br> =><br>
#

以上是关于json 维修SOCODA ELK的主要内容,如果未能解决你的问题,请参考以下文章

json ELK SCRIPTED TERM AGG

json ELK DEBUG SCRAPING

json ELK UPDATE DOC

json ELK只读允许删除索引被阻止

ELK之nginx日志使用json格式输出

ELK之filebeat收集多日志并自定义索引