• ES常见查询语句


    GET /_template/cargo_template
    
    GET cargo_index-202110/_search
    {
      "query": {
        "match_all": {}
      }
    }
    
    GET cargo_index-202111/_search
    {
      "query": {
        "match_all": {}
      },
      "sort": [
        {
          "createTime": {
            "order": "desc"
          }
        }
      ],
      "from": 0,
      "size": 100
    }
    
    GET _template 
    GET cargo_index-202111/_search
    {
      "query": {
        "match": {
          "cargoId": 29951002600481
    
        }
      }
    }
    
    GET /cargo_index-202110/_segments
    
    GET cargo_index-202201/_settings
    
    GET cargo_index-202110
    
    GET cargo_index-202110/_search
    {
      "query": {
        "match": {
          "cargoStatus": 2
        }
      }
    }
    
    HEAD cargo_index-202110
    
    GET cargo_index-202110/_search
    {
      "query": {
        "match": {
          "splendidSharedCar": 1
        }
      }
    }
    
    GET cargo_index-202110/_search
    {
      "query": {
        "match": {
          "dispatchStatus": 2
        }
      }
    }
    
    PUT /_template/cargo_template
    {
      "index_patterns": "cargo_index-*",
      "order": 1,
      "settings": {
        "refresh_interval": "1s",
        "number_of_shards": "10",
        "number_of_replicas": "1",
        "index.indexing.slowlog.threshold.index.warn": "50ms",
        "index.indexing.slowlog.threshold.index.info": "-1",
        "index.indexing.slowlog.threshold.index.debug": "-1",
        "index.indexing.slowlog.threshold.index.trace": "-1",
        "index.indexing.slowlog.level": "warn",
        "index.indexing.slowlog.source": "true",
        "index.search.slowlog.threshold.query.warn": "50ms",
        "index.search.slowlog.threshold.query.info": "-1",
        "index.search.slowlog.threshold.query.debug": "-1",
        "index.search.slowlog.threshold.query.trace": "-1",
        "index.search.slowlog.threshold.fetch.warn": "50ms",
        "index.search.slowlog.threshold.fetch.info": "-1",
        "index.search.slowlog.threshold.fetch.debug": "-1",
        "index.search.slowlog.threshold.fetch.trace": "-1",
        "index.search.slowlog.level": "warn"
      },
      "mappings": {
        "properties": {
          "cargoId": {
            "type": "long"
          },
          "endLoadTime": {
            "type": "long"
          },
          "cargoResource": {
            "type": "keyword"
          },
          "cargoCheck": {
            "type": "keyword"
          },
          "cargoStatus": {
            "type": "keyword"
          },
          "dispatchStatus": {
            "type": "keyword"
          },
          "loadProvince": {
            "type": "keyword"
          },
          "loadCity": {
            "type": "keyword"
          },
          "loadDistrict": {
            "type": "keyword"
          },
          "unloadProvince": {
            "type": "keyword"
          },
          "unloadCity": {
            "type": "keyword"
          },
          "unloadDistrict": {
            "type": "keyword"
          },
          "weightBefore": {
            "type": "integer"
          },
          "weightAfter": {
            "type": "integer"
          },
          "capacityBefore": {
            "type": "integer"
          },
          "capacityAfter": {
            "type": "integer"
          },
          "splendidSharedCar": {
            "type": "keyword"
          },
          "freight": {
            "type": "integer"
          },
          "plusFee": {
            "type": "integer"
          },
          "deposit": {
            "type": "integer"
          },
          "totalFreight": {
            "type": "integer"
          },
          "depositCanRefund": {
            "type": "keyword"
          },
          "createTime": {
            "type": "long"
          },
          "remark": {
            "type": "text"
          },
          "packageTypeCode": {
            "type": "text"
          },
          "packageTypeText": {
            "type": "text"
          },
          "betweenDistance": {
            "type": "integer"
          },
          "updateTime": {
            "type": "long"
          }
        }
      }
    }
    
    GET /_template/cargo_template
    
    
    GET cargo_index-202110/_mapping
    {
      "query": {
        "match_all": {}
      }
    }
    
    GET cargo_index-202110
    
    GET cargo_index-*/_search
    {
      "from": 0,
      "size": 10,
      "timeout": "1m",
      "query": {
        "bool": {
          "adjust_pure_negative": true,
          "boost": 1
        }
      },
      "_source": {
        "includes": [
          "cargoId",
          "endLoadTime",
          "cargoResource",
          "cargoCheck",
          "cargoStatus",
          "dispatchStatus",
          "loadProvince",
          "loadCity",
          "loadDistrict",
          "unloadProvince",
          "unloadCity",
          "unloadDistrict",
          "weightBefore",
          "weightAfter",
          "capacityBefore",
          "capacityAfter",
          "splendidSharedCar",
          "freight",
          "deposit",
          "depositCanRefund",
          "totalFreight",
          "createTime",
          "remark",
          "packageTypeCode",
          "packageTypeText",
          "betweenDistance"
        ],
        "excludes": []
      },
      "sort": [
        {
          "splendidSharedCar": {
            "order": "desc"
          }
        },
        {
          "createTime": {
            "order": "asc"
          }
        }
      ]
    }
    
    
    GET cargo_index-202110/_search
    {
      "query": {
        "wildcard": {
          "remark": {
            "value": "*"
          }
        }
      }
    }
    
    GET /cargo_index-202110/_search?pretty
    {
      "query": {
        "bool": {
          "must": [
            {"term": {
              "cargoId": {
                "value": 10141155359512
              }
            }},
            {"term": {
              "dispatchStatus": {
                "value": 1
              }
            }},{"range": {
              "endLoadTime": {
                "gte": 20,
                "lte": 1634659200000
              }
            }}
          ]
        }
      }
    }
    
    GET /cargo_index-202110/_search?pretty
    {
      "query": {
        "bool": {
          "must": [
            
            {"term": {
              "dispatchStatus": {
                "value": 1
              }
            }},{"range": {
              "endLoadTime": {
                "gte": 20,
                "lte": 1634659200000
              }
            }}
          ]
        }
      }
    }
  • 相关阅读:
    oracle学习篇十:序列
    oracle学习篇九:同义词
    oracle相关常识
    oracle之数据同步:Oracle Sql Loader使用说明(大批量快速插入数据库记录)
    oracle学习篇八:约束
    oracle学习篇七:更新操作、事务处理
    oracle学习篇六:子查询
    oracle学习篇五:组函数,分组统计
    oracle学习篇四:多表查询
    oracle学习篇三:SQL查询
  • 原文地址:https://www.cnblogs.com/juniorMa/p/15819539.html
Copyright © 2020-2023  润新知