TOPHITS查询

@param field
@return
323396
private AbstractAggregationBuilder makeTopHitsAgg(MethodField field) {
        String alias = gettAggNameFromParamsOrAlias(field);
        TopHitsAggregationBuilder topHits = AggregationBuilders.topHits(alias);
        List<KVValue> params = field.getParams();
        String[] include = null;
        String[] exclude = null;
        for (KVValue kv : params) {
            switch (kv.key) {
                case "from":
                    topHits.from((int) kv.value);
                    break;
                case "size":
                    topHits.size((int) kv.value);
                    break;
                case "include":
                    include = kv.value.toString().split(",");
                    break;
                case "exclude":
                    exclude = kv.value.toString().split(",");
                    break;
                case "alias":
                case "nested":
                case "reverse_nested":
                case "children":
                    break;
                default:
                    topHits.sort(kv.key, SortOrder.valueOf(kv.value.toString().toUpperCase()));
                    break;
            }
        }
        if (include != null || exclude != null) {
            topHits.fetchSource(include, exclude);
        }
        return topHits;
    }
692951
@SuppressWarnings("unchecked")
	public <T> T getOne(String field) {
		return (T) get(field).get(field);
	}
1250035
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case HANDLE:
      return isSetHandle();
    }
    throw new IllegalStateException();
  }
1347957
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case NUM_CPUS:
      return isSetNumCpus();
    case NETWORK_MBPS:
      return isSetNetworkMBps();
    case MEMORY_MB:
      return isSetMemoryMB();
    case DISK_GB:
      return isSetDiskGB();
    }
    throw new IllegalStateException();
  }
556134
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case WHY:
      return isSetWhy();
    }
    throw new IllegalStateException();
  }
311141
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case NIMBUS_MASTER:
      return is_set_nimbusMaster();
    case NIMBUS_SLAVES:
      return is_set_nimbusSlaves();
    case SUPERVISOR_NUM:
      return is_set_supervisorNum();
    case TOTAL_PORT_NUM:
      return is_set_totalPortNum();
    case USED_PORT_NUM:
      return is_set_usedPortNum();
    case FREE_PORT_NUM:
      return is_set_freePortNum();
    case VERSION:
      return is_set_version();
    }
    throw new IllegalStateException();
  }
1270301
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case SRC:
      return isSetSrc();
    case DST:
      return isSetDst();
    }
    throw new java.lang.IllegalStateException();
  }
95989
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case NAME:
      return isSetName();
    case VALUE:
      return isSetValue();
    case TIMESTAMP:
      return isSetTimestamp();
    case TTL:
      return isSetTtl();
    }
    throw new IllegalStateException();
  }
334556
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case IS_EMPTY:
      return isSetIs_empty();
    case BOOL_VAL:
      return isSetBool_val();
    case INT_VAL:
      return isSetInt_val();
    case LONG_VAL:
      return isSetLong_val();
    case FLOAT_VAL:
      return isSetFloat_val();
    case DOUBLE_VAL:
      return isSetDouble_val();
    case BINARY_VAL:
      return isSetBinary_val();
    case TYPE:
      return isSetType();
    }
    throw new IllegalStateException();
  }
548486
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case VALUES:
      return isSetValues();
    case NULLS:
      return isSetNulls();
    }
    throw new IllegalStateException();
  }
322502
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case PORT:
      return is_set_port();
    case UPTIME:
      return is_set_uptime();
    case TOPOLOGY:
      return is_set_topology();
    case TASKS:
      return is_set_tasks();
    }
    throw new IllegalStateException();
  }
466771
public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case TYPE_CLASS_NAME:
      return isSetTypeClassName();
    }
    throw new IllegalStateException();
  }
780034
public ASTField getField(Field field) {
        ASTAccessModifier modifier = ASTAccessModifier.getModifier(field.getModifiers());

        return new ASTClassField(field, getType(field.getType(), field.getGenericType()), modifier, getAnnotations(field));
    }
702416
private void primitiveGetter(Field field) {
    String typeName = field.getType().getName();
    String methodName = String.format("get%c%s", Character.toUpperCase(typeName.charAt(0)), typeName.substring(1));

    GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, getMethod(field.getType(), methodName, Object.class),
                                               null, new Type[0], classWriter);
    if (isPrivate) {
      // get the value using the generic Object get(Object) method and unbox the value
      mg.loadThis();
      mg.loadArg(0);
      mg.invokeVirtual(Type.getObjectType(className), getMethod(Object.class, "get", Object.class));
      mg.unbox(Type.getType(field.getType()));
    } else {
      // Simply access the field.
      mg.loadArg(0);
      mg.checkCast(Type.getType(field.getDeclaringClass()));
      mg.getField(Type.getType(field.getDeclaringClass()), field.getName(), Type.getType(field.getType()));
    }
    mg.returnValue();
    mg.endMethod();
  }
26882
public static String javaRepeatedEnumValueGetterByIndexName(Field field) {
        if (field.isRepeated()) {
            return GETTER_PREFIX + Formatter.toPascalCase(field.getName()) + VALUE;
        }
        throw new IllegalArgumentException(field.toString());
    }
444404
function toPlain(map) {

  var split;

  var form = {};
  var throwErr = function throwErr(key) {
    return log.error('map field name "' + key + '" is invalid');
  };
  var isInvalidKey = function isInvalidKey(str) {
    return str.split('.').length > 1;
  };
  var run = function run(n, o, p) {
    if (o.hasOwnProperty(p)) {
      n += '.' + p;
      if (typeof o[p] === 'string' || typeof o[p] === 'number' || typeof o[p] === 'boolean' || o[p] === undefined || o[p] === null) {
        n = n.substring(1);
        form[n] = o[p];
      } else {
        for (var k in o[p]) {
          if (isInvalidKey(k)) throwErr(k);
          run(n, o[p], k);
        }
      }
    }
  };

  for (var p in map) {
    if (isInvalidKey(p)) throwErr(p);
    run('', map, p);
  }

  return form;
}
962386
public int fieldIndex(String field) {
    Integer ret = mIndex.get(field);
    if (ret == null) {
      throw new IllegalArgumentException(field + " does not exist");
    }
    return ret;
  }