Java Code Examples for org.elasticsearch.common.settings.Settings#getAsFloat()
The following examples show how to use
org.elasticsearch.common.settings.Settings#getAsFloat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BalancedShardsAllocator.java From Elasticsearch with Apache License 2.0 | 6 votes |
@Override public void onRefreshSettings(Settings settings) { final float indexBalance = settings.getAsFloat(SETTING_INDEX_BALANCE_FACTOR, BalancedShardsAllocator.this.settings.getAsFloat(SETTING_INDEX_BALANCE_FACTOR, DEFAULT_INDEX_BALANCE_FACTOR)); final float shardBalance = settings.getAsFloat(SETTING_SHARD_BALANCE_FACTOR, BalancedShardsAllocator.this.settings.getAsFloat(SETTING_SHARD_BALANCE_FACTOR, DEFAULT_SHARD_BALANCE_FACTOR)); float threshold = settings.getAsFloat(SETTING_THRESHOLD, BalancedShardsAllocator.this.settings.getAsFloat(SETTING_THRESHOLD, DEFAULT_THRESHOLD)); if (threshold <= 0.0f) { throw new IllegalArgumentException("threshold must be greater than 0.0f but was: " + threshold); } BalancedShardsAllocator.this.threshold = threshold; BalancedShardsAllocator.this.weightFunction = new WeightFunction(indexBalance, shardBalance); }
Example 2
Source File: BM25SimilarityProvider.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Inject public BM25SimilarityProvider(@Assisted String name, @Assisted Settings settings) { super(name); float k1 = settings.getAsFloat("k1", 1.2f); float b = settings.getAsFloat("b", 0.75f); boolean discountOverlaps = settings.getAsBoolean("discount_overlaps", true); this.similarity = new BM25Similarity(k1, b); this.similarity.setDiscountOverlaps(discountOverlaps); }
Example 3
Source File: OrdinalsBuilder.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * Builds an {@link Ordinals} instance from the builders current state. */ public Ordinals build(Settings settings) { final float acceptableOverheadRatio = settings.getAsFloat("acceptable_overhead_ratio", PackedInts.FASTEST); final boolean forceMultiOrdinals = settings.getAsBoolean(FORCE_MULTI_ORDINALS, false); if (forceMultiOrdinals || numMultiValuedDocs > 0 || MultiOrdinals.significantlySmallerThanSinglePackedOrdinals(maxDoc, numDocsWithValue, getValueCount(), acceptableOverheadRatio)) { // MultiOrdinals can be smaller than SinglePackedOrdinals for sparse fields return new MultiOrdinals(this, acceptableOverheadRatio); } else { return new SinglePackedOrdinals(this, acceptableOverheadRatio); } }
Example 4
Source File: GeoSettingsApplier.java From crate with Apache License 2.0 | 5 votes |
private static void applyDistanceErrorPct(Map<String, Object> mapping, Settings geoSettings) { try { Float errorPct = geoSettings.getAsFloat("distance_error_pct", null); if (errorPct != null) { mapping.put("distance_error_pct", errorPct); } } catch (SettingsException e) { throw new IllegalArgumentException( String.format(Locale.ENGLISH, "Value '%s' of setting distance_error_pct is not a float value", geoSettings.get("distance_error_pct")) ); } }
Example 5
Source File: FloatSetting.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Override public Float extract(Settings settings) { return settings.getAsFloat(settingName(), defaultValue()); }
Example 6
Source File: LMJelinekMercerSimilarityProvider.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Inject public LMJelinekMercerSimilarityProvider(@Assisted String name, @Assisted Settings settings) { super(name); float lambda = settings.getAsFloat("lambda", 0.1f); this.similarity = new LMJelinekMercerSimilarity(lambda); }
Example 7
Source File: LMDirichletSimilarityProvider.java From Elasticsearch with Apache License 2.0 | 4 votes |
@Inject public LMDirichletSimilarityProvider(@Assisted String name, @Assisted Settings settings) { super(name); float mu = settings.getAsFloat("mu", 2000f); this.similarity = new LMDirichletSimilarity(mu); }
Example 8
Source File: DecompoundTokenFilterFactory.java From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 | 4 votes |
private Map<String, List<String>> createCache(Settings settings) { int cachesize = settings.getAsInt("cache_size", 100000); float evictionfactor = settings.getAsFloat("cache_eviction_factor", 0.90f); return Collections.synchronizedMap(new LFUCache<>(cachesize, evictionfactor)); }