Returns a map of field names to the corresponding field types.

@param fieldNames a collection of field names to get the types for
@param indexNames a collection of index names to filter the results
@return map of field names to field type objects
507569
@Override
    public Map<String, FieldTypes> get(final Collection<String> fieldNames, Collection<String> indexNames) {
        // Shortcut - if we don't select any fields we don't have to do any database query
        if (fieldNames.isEmpty()) {
            return Collections.emptyMap();
        }

        // We have to transform the field type database entries to make them usable for the user.
        //
        // [
        //   {
        //     "index_name": "graylog_0",
        //     "fields": [
        //       {"field_name": "message", "physical_type": "text"},
        //       {"field_name": "source", "physical_type": "keyword"}
        //     ]
        //   },
        //   {
        //     "index_name": "graylog_1",
        //     "fields": [
        //       {"field_name": "message", "physical_type": "text"},
        //     ]
        //   }
        // ]
        //
        // gets transformed into
        //
        // {
        //   "message": {
        //     "field_name": "message",
        //     "types": [
        //       {
        //         "type": "string",
        //         "properties": ["full-text-search"],
        //         "index_names": ["graylog_0", "graylog_1"]
        //     ]
        //   },
        //   "source": {
        //     "field_name": "source",
        //     "types": [
        //       {
        //         "type": "string",
        //         "properties": ["enumerable"],
        //         "index_names": ["graylog_0"]
        //     ]
        //   }
        // }

        // field-name -> {physical-type -> [index-name, ...]}
        final Map<String, SetMultimap<String, String>> fields = new HashMap<>();

        // Convert the data from the database to be indexed by field name and physical type
        getTypesStream(fieldNames, indexNames).forEach(types -> {
            final String indexName = types.indexName();

            types.fields().forEach(fieldType -> {
                final String fieldName = fieldType.fieldName();
                final String physicalType = fieldType.physicalType();

                if (fieldNames.contains(fieldName)) {
                    if (indexNames.isEmpty() || indexNames.contains(indexName)) {
                        if (!fields.containsKey(fieldName)) {
                            fields.put(fieldName, HashMultimap.create());
                        }
                        fields.get(fieldName).put(physicalType, indexName);
                    }
                }
            });
        });

        final ImmutableMap.Builder<String, FieldTypes> result = ImmutableMap.builder();

        for (Map.Entry<String, SetMultimap<String, String>> fieldNameEntry : fields.entrySet()) {
            final String fieldName = fieldNameEntry.getKey();
            final Map<String, Collection<String>> physicalTypes = fieldNameEntry.getValue().asMap();

            // Use the field type mapper to do the conversion between the Elasticsearch type and our logical type
            final Set<FieldTypes.Type> types = physicalTypes.entrySet().stream()
                    .map(entry -> {
                        final String physicalType = entry.getKey();
                        final Set<String> indices = ImmutableSet.copyOf(entry.getValue());

                        return typeMapper.mapType(physicalType).map(t -> t.withIndexNames(indices));
                    })
                    .filter(Optional::isPresent)
                    .map(Optional::get)
                    .collect(Collectors.toSet());

            result.put(fieldName, FieldTypes.create(fieldName, types));
        }

        return result.build();
    }
1332057
public void setFieldNames(List<String> fieldNames) {
    this.fieldNames = fieldNames;
    if (fields.length != fieldNames.size()) {
      Object[] oldFields = fields;
      fields = new Object[fieldNames.size()];
      System.arraycopy(oldFields, 0, fields, 0,
          Math.min(oldFields.length, fieldNames.size()));
    }
  }
722930
@Override
  public List<ApiType> byIndex(String indexName, String indexKey) {
    lock.lock();
    try {
      if (!this.indexers.containsKey(indexName)) {
        throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
      }
      Map<String, Set<String>> index = this.indices.get(indexName);
      Set<String> set = index.get(indexKey);
      if (set == null) {
        return Arrays.asList();
      }
      List<ApiType> items = new ArrayList<>(set.size());
      for (String key : set) {
        items.add(this.items.get(key));
      }
      return items;
    } finally {
      lock.unlock();
    }
  }
792971
def getfieldnamesendswith(idfobject, endswith):
    """"""
    objls = idfobject.objls
    tmp = [name for name in objls if name.endswith(endswith)]
    if tmp == []:
        pass
    return [name for name in objls if name.endswith(endswith)]
293352
public void removeSearchIndexes(List<String> indexNames) {

        Iterator<String> i = indexNames.iterator();
        while (i.hasNext()) {
            String indexName = i.next();
            // get the search index by name
            I_CmsSearchIndex index = getIndex(indexName);
            if (index != null) {
                // remove the index
                removeSearchIndex(index);
            } else {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(Messages.get().getBundle().key(Messages.LOG_NO_INDEX_WITH_NAME_1, indexName));
                }
            }
        }
    }
1099809
def get_field_mappings(self, field):
        """"""
        retdict = {}
        retdict['indexed'] = False
        retdict['analyzed'] = False
        for (key, val) in iteritems(field):
            if key in self.mappings:
                if (key == 'type' and
                    (val == "long" or
                     val == "integer" or
                     val == "double" or
                     val == "float")):
                    val = "number"
                # self.pr_dbg("\t\t\tkey: %s" % key)
                # self.pr_dbg("\t\t\t\tval: %s" % val)
                retdict[key] = val
            if key == 'index' and val != "no":
                retdict['indexed'] = True
                # self.pr_dbg("\t\t\tkey: %s" % key)
                # self.pr_dbg("\t\t\t\tval: %s" % val)
                if val == "analyzed":
                    retdict['analyzed'] = True
        return retdict
111790
public static <T> T[] getAny(Object array, int... indexes) {
		if(null == array) {
			return null;
		}
		
		final T[] result = newArray(array.getClass().getComponentType(), indexes.length);
		for (int i : indexes) {
			result[i] = get(array, i);
		}
		return result;
	}
679914
List<Field> getFields(Class<?> clazz) {
        List<Field> result = new ArrayList<>();
        Set<String> fieldNames = new HashSet<>();
        Class<?> searchType = clazz;
        while (!Object.class.equals(searchType) && searchType != null) {
            Field[] fields = searchType.getDeclaredFields();
            for (Field field : fields) {
                if (!fieldNames.contains(field.getName())) {
                    fieldNames.add(field.getName());
                    makeAccessible(field);
                    result.add(field);
                }
            }
            searchType = searchType.getSuperclass();
        }
        return result;
    }
1204487
public void selectByIndex(String[] indexes) {
        for (int i = 0; i < indexes.length; i++) {
            selectByIndex(Integer.parseInt(indexes[i]));
        }
    }
918409
public void setIndexNames(java.util.Collection<String> indexNames) {
        if (indexNames == null) {
            this.indexNames = null;
            return;
        }

        this.indexNames = new java.util.ArrayList<String>(indexNames);
    }
11222
@NotNull
    public Map<String, Set<String>> getIndexNamesAndAliases(String indexPattern) {
        // only request indices matching the name or pattern in `indexPattern` and only get the alias names for each index,
        // not the settings or mappings
        final GetAliases request = new GetAliases.Builder()
                .addIndex(indexPattern)
                // ES 6 changed the "expand_wildcards" default value for the /_alias API from "open" to "all".
                // Since our code expects only open indices to be returned, we have to explicitly set the parameter now.
                .setParameter("expand_wildcards", "open")
                .build();

        final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't collect aliases for index pattern " + indexPattern);

        final ImmutableMap.Builder<String, Set<String>> indexAliasesBuilder = ImmutableMap.builder();
        final Iterator<Map.Entry<String, JsonNode>> it = jestResult.getJsonObject().fields();
        while (it.hasNext()) {
            final Map.Entry<String, JsonNode> entry = it.next();
            final String indexName = entry.getKey();
            final JsonNode aliasMetaData = entry.getValue().path("aliases");
            if (aliasMetaData.isObject()) {
                final ImmutableSet<String> aliasNames = ImmutableSet.copyOf(aliasMetaData.fieldNames());
                indexAliasesBuilder.put(indexName, aliasNames);
            }
        }

        return indexAliasesBuilder.build();
    }
735228
private void createIndex(String tableName, String indexName, String... fieldNames)
    {
        StringBuilder builder = new StringBuilder();
        builder.append("CREATE INDEX IF NOT EXISTS ");
        builder.append(indexName);
        builder.append(" ON ");
        builder.append(tableName);
        builder.append(Constants.OPEN_ROUND_BRACKET);
        for (String fieldName : fieldNames)
        {
            builder.append(fieldName);
            builder.append(Constants.COMMA);
        }
        builder.deleteCharAt(builder.length() - 1);
        builder.append(Constants.CLOSE_ROUND_BRACKET);
        StatementResult result = tableAPI.executeSync(builder.toString());
        if (!result.isSuccessful())
        {
            throw new SchemaGenerationException("Unable to CREATE Index with Index Name [" + indexName
                    + "] for table [" + tableName + "]");
        }
    }
681534
public String addDateDocuments(String indexName, String indexType, List<?> beans) throws ElasticSearchException{
		return addDocuments(this.indexNameBuilder.getIndexName(indexName),   indexType,     beans);
	}
555378
private int findIndexForName(String[] fieldNames, String searchName)
    {
        for(int i = 0; i < fieldNames.length; i++)
        {
            if(searchName.equals(fieldNames[i]))
            {
                return i;
            }
        }
        throw new PersistenceBrokerException("Can't find field name '" + searchName +
                "' in given array of field names");
    }
95308
public Entity setFieldNames(Collection<String> fieldNames) {
		if (CollectionUtil.isNotEmpty(fieldNames)) {
			this.fieldNames = new HashSet<String>(fieldNames);
		}
		return this;
	}
1244105
String tableNameForIndexName(String indexName) {
        // the schema manager has a map of indexes by name
        // if this shows up on profiles, you can try to use that, but beware
        // the case insensitivity going on here
        HashMappedList hsqlTables = getHSQLTables();
        for (int i = 0; i < hsqlTables.size(); i++) {
            Table table = (Table) hsqlTables.get(i);
            for (Index index : table.getIndexList()) {
                if (index.getName().name.equalsIgnoreCase(indexName)) {
                    return table.getName().name.toLowerCase();
                }
            }
        }
        return null;
    }
821297
public static synchronized void registerFieldsToFilter(Class<?> containingClass,
                                              String ... fieldNames) {
        fieldFilterMap =
            registerFilter(fieldFilterMap, containingClass, fieldNames);
    }