ES bak2

发布时间 2023-11-09 09:43:42作者: dreamno
GET cdpe/label/_search
{
  "query": {
    "terms": {
      "OBJECTID": [
"400000001",
"400000002",
"400000003",
"400000004",
"400000005"
      ]
    }
  },
  "size": 10
}


GET member2/label/_search
{
  "query": {
    "match_all": {}
  }
}



POST cdpe/label/400000001/_update
{
"doc":
  {
    "PROFILE1" : "400000001",
    "PROFILE2" : "400000001",
    "PROFILE17" : "未知",

    "PHONE" : "1*****628",
    "OBJECTID" : "400000001",
    "PROFILE30" : "400000001",
    "PROFILE90" : "41",

    "PROFILE3" : "_海",
    "PROFILE36" : "22",

    "LABEL984_VERSION" : "1698656574643",
    "LABEL984_VALUE" : "半年",
    "LABEL983_VALUE" : "非常有钱",
    "LABEL983_VERSION" : "1698656574643",

    "LABEL979_VALUE" : "是",
    "LABEL979_VERSION" : "1698656574643"
  }
}


POST cdpe/label/400000002/_update
{
 "doc":
  {
    "PROFILE1" : "400000002",
    "PROFILE2" : "400000002",
    "PROFILE31" : "YHDR:wxf6aa337a93d7e0a6,ULPWXMP:wxb585c8bb240d500b",
    "PROFILE35" : "YHDR:o8KSZ5bBSST7IssQ2iHdVax0l7kg",
    "PROFILE17" : "男",
    "PHONE" : "1*****005",
    "PROFILE90" : "42",

    "PROFILE30" : "400000002",
    "OBJECTID" : "400000002",
    "PROFILE3" : "王",
    "PROFILE36" : "21",

    "LABEL984_VERSION" : "1698656574643",
    "LABEL984_VALUE" : "半年",
    "LABEL983_VALUE" : "非常有钱",
    "LABEL983_VERSION" : "1698656574643",

    "LABEL979_VALUE" : "是",
    "LABEL979_VERSION" : "1698656574643",

    "LABEL980_VALUE" : "_3884_,_3882_,_3883_,_3879_,_3880_,_3877_,_3878_",
    "LABEL980_VERSION" : "1698656574643"

  }
}


POST cdpe/label/400000003/_update
{
 "doc":
  {
    "PROFILE1" : "400000003",
    "PROFILE2" : "400000003",
    "PROFILE31" : "YHDR:wxb585c8bb240d500b,ULPWXMP:wxb585c8bb240d500b",
    "PROFILE35" : "Terminus:oghzNwI5m-00Rq_8bbWVyQkTHyxx,ULPWXMP:ou1yB5fIqEFFmjPjt0_Rywh-Bu12",
    "PROFILE17" : "未知",
    "PHONE" : "1*****737",
    "PROFILE90" : "43",

    "PROFILE30" : "400000003",
    "OBJECTID" : "400000003",

    "PROFILE3" : "鹏",
    "PROFILE36" : "26"
  }
}

POST cdpe/label/400000004/_update
{
 "doc":
  {
    "PROFILE17" : "未知",
    "PHONE" : "1*****167",
    "PROFILE30" : "400000004",
    "OBJECTID" : "400000004",
    "PROFILE1" : "400000004",
    "PROFILE2" : "400000004",

    "PROFILE31" : "YHDR:wxf6aa337a93d7e0a6",
    "PROFILE35" : "YHDR:o8KSZ5QjFGZCoPEeE2Bg2c_fiKaw",
    "PROFILE3" : "崔",
    "PROFILE36" : "25",
    "PROFILE90" : "44",

    "LABEL984_VERSION" : "1698656574643",
    "LABEL984_VALUE" : "半年",
    "LABEL983_VALUE" : "非常有钱",
    "LABEL983_VERSION" : "1698656574643"
  }
}


POST cdpe/label/400000005/_update
{
 "doc":
  {
    "PROFILE1" : "400000005",
    "PROFILE2" : "400000005",
    "PROFILE17" : "未知",
    "PHONE": "1*****462",

    "PROFILE30" : "400000005",
    "OBJECTID" : "400000005",
    "PROFILE90" : "45",

    "LABEL984_VERSION" : "1698656574643",
    "LABEL984_VALUE" : "半年",
    "LABEL983_VALUE" : "非常有钱",
    "LABEL983_VERSION" : "1698656574643",

    "PROFILE3" : "集",
    "PROFILE36" : "23",

    "LABEL979_VALUE" : "是",
    "LABEL979_VERSION" : "1698656574643"
  }
}










# uat
!! UAT


GET _cat/allocation?v&h=node,disks,disk.used,disk.avail

GET member2/_settings/_cat/indices?h=h,s,i,id,p,r,dc,dd,ss,creation.date.string


GET member2/label/_mapping


PUT member2/_settings
{
  "index.max_result_window": "100"
}

POST tasks_uat/task/_update_by_query
{
  "script": {
    "inline": "ctx._source.modelName='12.1-12.14未购列表导出-2'"
  },
  "query": {
    "match": {
      "_id": "10011"
    }
  },"sort": [
    {
      "id": {
        "order": "desc"
      }
    }
  ]
}

GET tasks_uat/task/_search
{
  "query": {
    "match": {
      "processInstanceId": "af339ac1-3dbd-11eb-8949-1edc1b3973ca"
    }
  },"sort": [
    {
      "id": {
        "order": "desc"
      }
    }
  ]
}

============== query begin ==================

GET member2/label/_search
{
  "query": {
    "match_phrase": {
      "PHONE_MD5": "4"
    }
  }
}


GET member2/label/_search
{
  "query": {
    "bool": {
      "must_not": [
        {
          "match_phrase": {
            "LABEL286_VALUE": ""
          }
        }
      ],
      "must": [
        {
          "exists": {
            "field": "LABEL286_VALUE"
          }
        },
        {
          "exists": {
            "field": "LABEL287_VALUE"
          }
        }
      ]
    }
  },
  "size": 200
}



GET member2/label/_search
{
  "query": {
    "wildcard": {
      "PROFILE35": {
        "value": "*,*"
      }
    }
  }
}


GET member2/label/_search
{
  "query": {
    "wildcard": {
      "PROFILE31": {
        "value": "*,*"
      }
    }
  }
}


POST member2/label/_update_by_query
{
  "script": {
    "inline": "ctx._source.LABEL159_VALUE='九江市'; ctx._source.LABEL159_VERSION='V1'"
  },
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "LABEL159_VALUE"
          }
        }
      ],
      "must": [
        {
          "exists": {
            "field": "OBJECTID"
          }
        }
      ]
    }
  },
  "size": 200000
}

POST member2/label/_update_by_query
{
 "script": "ctx._source.remove('LABEL308_VALUE');ctx._source.remove('LABEL309_VALUE');ctx._source.remove('LABEL310_VALUE')",
  "query": {
    "match_all": {}
  }
}

GET member2/label/_search
{
  "query": {
    "match_phrase": {
      "LABEL159_VALUE": "九江市"
    }
  }
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "LABEL159_VALUE"
          }
        }
      ],
      "must": [
        {
          "exists": {
            "field": "OBJECTID"
          }
        }
      ]
    }
  },
  "size": 20
}


############# start ####


GET member2/label/_search
{
  "query": {
    "match_phrase": {
      "PHONE": "1*****369"
    }
  }
}


GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "PHONE": "1*****003"
          }
        },
        {
          "match_phrase": {
            "LABEL159_VALUE": "南市"
          }
        }
      ]
    }
  }
}

GET member2/label/2718119410
GET member2/label/4083905366

POST member2/label/801f34d3e3ddf8ec96bfb1082f5a96bd/_update
{
 "doc": {
    "LABEL302_VALUE": "是,否,nieweiwei"
 }
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "LABEL302_VALUE": {
              "value": "nieweiwei"
            }
          }
        },
        {
          "term": {
            "LABEL302_VALUE": {
              "value": "是"
            }
          }
        }
      ]
    }
  }
}

GET member2/_analyze
{
  "field": "LABEL302_VALUE",
  "text": [
    "是 否"
    ]
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
           "fuzzy": {
            "LABEL302_VALUE": {
              "value": "niewwwwei"
            }
          }
        }
      ]
    }
  }
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "default_field": "LABEL302_VALUE",
            "query": "否 AND 是"
          }
        }
      ]
    }
  }
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "LABEL302_VALUE": [
              "是"
            ]
          }
        },
        {
          "query_string": {
            "default_field": "FIELD",
            "query": "this AND that OR thus"
          }
        }
      ]
    }
  }
}
############## end ###

GET member2/_mapping
GET _cat/shards/member2?v
GET _cat/indices/member2?v
GET _cat/segments/member2?v

GET _cat/segments/member2?v&h=shard,segment,size,size.momery,ip

GET member2/_settings
GET _cluster/settings?pretty


GET member2/label/ff231f09c6dfe16a5e9bc62a0148e36d

GET member2/label/_search
{
  "_source": [
    "LABEL308_VALUE",
    "LABEL309_VALUE",
    "OBJECTID"
    ],
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL308_VALUE": "是"
          }
        },
        {
          "match_phrase": {
            "LABEL309_VALUE": "是"
          }
        }
      ]
    }
  },
  "size": 200
}


GET member2/label/_search
{
  "query": {
    "exists": {
      "field": "LABEL309_VALUE"
    }
  }
}



GET member2/label/_search
{

  "query": {
    "exists": {
      "field": "LABEL308_VALUE"
    }
  }
}

GET member2/label/_search
{
  "query": {
    "match_phrase": {
      "OBJECTID": "8179000003"
    }
  }
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL308_VALUE": "是"
          }
        },
       {
          "match_phrase": {
            "LABEL309_VALUE": "是"
          }
        }
      ]
    }
  }
}


GET member2/label/_search
{
  "query": {
    "wildcard": {
      "PROFILE35": {
        "value": "*oghzNwB7tgWod1aXAFBVR8kJ0KtQ*"
      }
    }
  }
}


POST member2/label/_update_by_query
{
  "script": {
    "inline": "ctx._source.LABEL103_VALUE='是'; ctx._source.LABEL103_VERSION='V1'"
  },
  "query": {
    "terms": {
      "_id": [
        "3795265602",
        "2587685615",
        "4119814492"
      ]
    }
  }
}

GET member2/label/_search
{
  "script_fields": {
    "moddd": {
      "script": {
        "lang": "painless",
        "source": "params._source.PHONE"
      }
    }
  }
}

GET member2/label/_search
{
  "script_fields": {
    "moddd": {
      "script": {
        "lang": "painless",
        "source": "long a = 1 ; a%3"
      }
    }
  }
}

GET member2/label/_search
{
  "script_fields": {
    "moddd": {
      "script": {
        "lang": "painless",
        "source": "int a = doc['PHONE'].value"
      }
    }
  }
}

GET my_index/_search
{
  "script_fields": {
    "source": {
      "script": {
        "lang": "painless",
        "source": "params._source.title + ' ' + params._source.first_name + ' ' + params._source.last_name"
      }
    },
    "stored_fields": {
      "script": {
        "lang": "painless",
        "source": "params._fields['first_name'].value + ' ' + params._fields['last_name'].value"
      }
    }
  }
}

GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL285_VALUE": "X"
          }
        },
        {
          "match_phrase": {
            "LABEL281_VALUE": "L2_3"
          }
        },
        {
          "match_phrase": {
            "LABEL103_VALUE": "是"
          }
        },
        {
          "match_phrase": {
            "LABEL281_VERSION": "1598846864700"
          }
        },
        {
          "match_phrase": {
            "LABEL285_VERSION": "1598846953622"
          }
        }
      ]
    }
  }
}


GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL282_VALUE": "L"
          }
        },
        {
          "term": {
            "LABEL282_VERSION": {
              "value": "1597910308803",
              "boost": 1.0
            }
          }
        },
        {
          "bool": {
            "must_not": [
              {
                "match_phrase": {
                  "LABEL281_VALUE": "L2_3"
                }
              }
            ]
          }
        },
        {
          "term": {
            "LABEL281_VERSION": {
              "value": "1597910261775",
              "boost": 1.0
            }
          }
        }
      ]
    }
  }
}



GET member2/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL282_VALUE": "L"
          }
        },
        {
          "term": {
            "LABEL282_VERSION": {
              "value": "1597899803380",
              "boost": 1.0
            }
          }
        },
        {
          "match_phrase": {
            "LABEL281_VALUE": "L2_3"
          }
        },
        {
          "term": {
            "LABEL281_VERSION": {
              "value": "1597899756296",
              "boost": 1.0
            }
          }
        }
      ]
    }
  }
}

GET member2/label/_search
{
query {
  "bool" : {
    "must" : [
      {
        "bool" : {
          "should" : [
            {
              "term" : {
                "LABEL282_VALUE" : {
                  "value" : "L",
                  "boost" : 1.0
                }
              }
            }
          ],
          "adjust_pure_negative" : true,
          "boost" : 1.0
        }
      },
      {
        "term" : {
          "LABEL282_VERSION" : {
            "value" : "V1",
            "boost" : 1.0
          }
        }
      },
      {
        "bool" : {
          "should" : [
            {
              "term" : {
                "LABEL281_VALUE" : {
                  "value" : "L2_3",
                  "boost" : 1.0
                }
              }
            }
          ],
          "adjust_pure_negative" : true,
          "boost" : 1.0
        }
      },
      {
        "term" : {
          "LABEL281_VERSION" : {
            "value" : "V1",
            "boost" : 1.0
          }
        }
      }
    ],
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}
}



GET member2/label/_search
{
  "query": {
    "wildcard": {
      "PROFILE3": {
        "value": "*双"
      }
    }
  }
}

GET label2/label/_search
{
  "query": {
    "terms": {
      "PROFILE30": [
        "2109216183",

        "1452623476",

        "1334736693",

        "3356912634",

        "17664965"
      ]
    }
  }
}

# 1270100050  1270100060

GET member2/label/_search
{
  "query": {
    "terms": {
      "_id": [
        "2109216183",

        "1452623476",

        "1334736693",

        "3356912634",

        "17664965"

      ]
    }
  }
}



#############################
#############################
#############################


GET label/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL103_VALUE": "是"
          }
        },
        {
          "bool": {
            "must_not": [
              {
                "terms": {
                  "LABEL159_VALUE": [
                    "西市",
                    "河市"
                  ]
                }
              }
            ]
          }
        },
        {
          "wildcard": {
            "LABEL159_VALUE": {
              "value": "*市"
            }
          }
        }
      ]
    }
  }
}

GET label/label/_search
{
  "query": {
    "match_phrase": {
      "LABEL159_VALUE": "乐山市"
    }
  }
}

#POST label/label/4116344893/_update
#{
# "doc": {
#    "LABEL268_VALUE": "2500-3000"
# }
#}

GET label/label/_search
{
  "_source": [
    "PHONE",
    "PROFILE35",
    "PROFILE30"
    ],
  "query": {
    "regexp": {
      "PHONE": ".*[^0-9].*"
    }
  }
}

GET member/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL24_VALUE": "男"
          }
        },
        {
          "regexp": {
            "PHONE": ".*[^0-9].*"
          }
        }
      ]
    }
  },
  "size": 2000
}

GET label/label/_search
{
  "_source": [
    "PHONE"
    ],
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL103_VALUE": "是"
          }
        },
        {
          "regexp": {
            "PHONE": ".*[^0-9].*"
          }
        }
      ]
    }
  },
  "size": 2000
}


GET label/label/_search
{
  "query": {
    "bool": {
      "must_not": [
        {
          "bool": {
            "filter": {
              "exists": {
                "field": "OBJECTID"
              }
            }
          }
        }
      ]
    }
  }
}

GET label/label/_search
{
  "query": {
    "match_phrase": {
      "PROFILE30": "0"
    }
  }
}

GET label/label/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL159_VALUE": "七台河市"
          }
        },
        {
          "bool": {
            "filter": {
              "exists": {
                "field": "PHONE"
              }
            }
          }
        }
      ]
    }
  },
  "size": 20000,
  "aggs": {
    "testagg": {
      "cardinality": {
        "field": "PROFILE30"
      }
    }
  }
}


GET label/label/_search
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "LABEL159_VALUE": "七台河市"
          }
        },
        {
          "bool": {
            "filter": {
              "exists": {
                "field": "PHONE"
              }
            }
          }
        }
      ]
    }
  },
  "aggs": {
    "group_by_tags": {
      "terms": {
        "field": "PHONE",
        "size": 30000
      }
    }
  }
}

GET label/label/_search
{
  "size": 0,
  "aggs": {
    "group_by_tags": {
      "terms": {
        "field": "PROFILE35"
      }
    }
  }
}


---------################
POST label/label/_update_by_query
{
  "script": {
    "inline": "ctx._source.LABEL159_VALUE='七台河市'; ctx._source.LABEL159_VERSION='V1'"
  },
  "query": {
    "match_all": {}
  }
}

GET label/label/_search
{
  "_source": [
    "PROFILE3"
    ],
  "query": {
    "match_phrase": {
      "PROFILE32": "2020-04-24"
    }
  }
}

============================================


DELETE  member2

GET member2/_mapping

PUT member2
{
	"settings": {
		"analysis": {
			"analyzer": {
				"comma": {
					"type": "pattern",
					"pattern": ","
				}
			}
		},
		"max_result_window": 500000
	},
	"mappings": {
		"label": {
			"dynamic_templates": [{
				"value_text": {
					"match": "*_VALUE",
					"match_mapping_type": "string",
					"mapping": {
						"type": "text",
						"analyzer": "comma"
					}
				}
			}, {
				"version_text": {
					"match": "*_VERSION",
					"match_mapping_type": "string",
					"mapping": {
						"type": "keyword"
					}
				}
			}]
		}
	}
}


POST  member2/label/_mapping
{
    "label": {
        "properties": {
          "OBJECTID": {
            "type": "long"
          },
          "PHONE": {
        		"type": "keyword"
        	},
        	"PROFILE1": {
        		"type": "keyword"
        	},
        	"PROFILE2": {
        		"type": "keyword"
        	},
        	"PROFILE3": {
        		"type": "keyword"
        	},
        	"PROFILE4": {
        		"type": "keyword"
        	},
        	"PROFILE5": {
        		"type": "keyword"
        	},
        	"PROFILE6": {
        		"type": "keyword"
        	},
        	"PROFILE7": {
        		"type": "keyword"
        	},
        	"PROFILE8": {
        		"type": "keyword"
        	},
        	"PROFILE9": {
        		"type": "keyword"
        	},
        	"PROFILE10": {
        		"type": "keyword"
        	},
        	"PROFILE11": {
        		"type": "keyword"
        	},
        	"PROFILE12": {
        		"type": "keyword"
        	},
        	"PROFILE13": {
        		"type": "long"
        	},
        	"PROFILE74": {
        		"type": "keyword"
        	},
        	"PROFILE75": {
        		"type": "keyword"
        	}
        }
      }
}

PUT  member2/_settings
{
    "max_result_window"  :  500000

}


GET member2/_mapping
GET member3/_mapping

GET _tasks?actions=*reindex&detailed
GET _tasks?actions=*update&detailed
GET _tasks?actions=*del*&detailed

GET _tasks?detailed=true&actions=*reindex


POST _tasks/DNpIfivxTEWpg5q_x3H5-g:99078914/_cancel



!! 测试


GET member3_test_perf/label/_search
{
  "query": {
    "regexp": {
      "PHONE": "1[0-9]{10}"
    }
  }
}



GET member3_test_perf/_settings

PUT member3_test_perf/_settings
{
  "settings": {
    "index.blocks.read_only_allow_delete": false
  }
}

POST member3_test_perf/label/_update_by_query
{
 "script": "ctx._source.remove('LABEL296_VALUE');ctx._source.remove('LABEL296_VERSION')",
  "query": {
    "match_all": {}
  }
}



POST _reindex
{
  "source": {
    "index": "member2",
    "_source": ["PROFILE*", "PHONE", "OBJECTID"],
    "size": 100000
  },
  "dest": {
    "index": "member3_test_perf"
  }
}



POST member3_test_perf/_delete_by_query
{
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "OBJECTID"
          }
        },
        {
          "exists": {
            "field": "PHONE"
          }
        },
        {
          "exists": {
            "field": "PROFILE1"
          }
        },
        {
          "exists": {
            "field": "PROFILE3"
          }
        },
        {
          "exists": {
            "field": "PROFILE18"
          }
        }
      ]
    }
  }
}



POST member3_test_perf/_forcemerge?max_num_segments=1


GET member3_test_perf/label/_search
{
  "query": {
    "wildcard": {
      "PROFILE1": {
        "value": "30000000*"
      }
    }
  }
}