zoukankan      html  css  js  c++  java
  • 当url作为id时的删除

    API Documentation — Elasticsearch 6.3.1 documentation https://elasticsearch-py.readthedocs.io/en/master/api.html

    import os, json, re

    kw_d = {'悠牛': 'u69cn.com', '际通宝': 'gtobal.com', '贸商网': 'mao35.com', '客集齐网': 'kejiqi.com', '企业谷': 'qiyegu.com',
    '搜了网': '51sole.com', '搜了网': '51sole.com'}

    from elasticsearch import Elasticsearch
    import random

    es = Elasticsearch(
    ['11.7.217.10:9200', '10.5.32.114:9200', '10.6.84.7:9200', '10.2.192.92:9200'],
    )

    while True:
    for kw in kw_d:
    curl = 'curl -d "keyword={}" http://59.1.16.24/Diad/iex/inex'.format(kw)
    r = os.popen(curl)
    info = r.readlines()
    m_str = '^.+' + kw_d[kw] + '.+$'
    print(m_str)
    t = json.loads(info[0])
    url_l = [i['url'] for i in t if re.match(m_str, i['url']) is not None]
    a = random.randint(0, 1000)
    b = random.randint(a, 1000)
    while b < a:
    b = random.randint(a, 1001)
    for i in url_l[a:b]:
    try:
    print(i)
    # index, doc_type, id
    r = es.delete('direct_vote', 'kwaddress', i)
    print(r)
    except Exception as e:
    print(e)



  • 相关阅读:
    regedit注册表
    Environment应用
    VMI帮助类
    Image帮助类
    asp.net core+Postman
    printf和cout的区别详述
    C++指针
    Qt button和buttons区别
    visual studio收函数
    编译警告
  • 原文地址:https://www.cnblogs.com/rsapaper/p/10105242.html
Copyright © 2011-2022 走看看