The numericAttributesForFiltering parameter defines which numeric attributes can be used for filtering.
By default, all numeric attributes are available, but you can limit them for faster indexing and reduced index size.
Usage
Attribute names are case-sensitive.
If you pass an empty list or null, all numeric attributes are filterable.
To turn off numeric filtering entirely, pass an attribute that doesn’t exist (such as _no_numeric_attributes_).
Modifiers
Use this modifier when the attribute should only support equality filters (= or !=).
This disables range-based filtering (<, <=, >, >=) for the attribute and improves performance.
Example
C#
Dart
Go
Java
JavaScript
Kotlin
PHP
Python
Ruby
Scala
Swift
var response = await client . SetSettingsAsync (
"INDEX_NAME" ,
new IndexSettings
{
NumericAttributesForFiltering = new List < string > { "quantity" , "popularity" },
}
);
final response = await client. setSettings (
indexName : "INDEX_NAME" ,
indexSettings : IndexSettings (
numericAttributesForFiltering : [
"quantity" ,
"popularity" ,
],
),
);
response , err := client . SetSettings ( client . NewApiSetSettingsRequest (
"INDEX_NAME" ,
search . NewEmptyIndexSettings (). SetNumericAttributesForFiltering (
[] string { "quantity" , "popularity" })))
if err != nil {
// handle the eventual error
panic ( err )
}
UpdatedAtResponse response = client . setSettings (
"INDEX_NAME" ,
new IndexSettings (). setNumericAttributesForFiltering ( Arrays . asList ( "quantity" , "popularity" ))
);
const response = await client . setSettings ({
indexName: 'theIndexName' ,
indexSettings: { numericAttributesForFiltering: [ 'quantity' , 'popularity' ] },
});
var response =
client. setSettings (
indexName = "INDEX_NAME" ,
indexSettings =
IndexSettings (numericAttributesForFiltering = listOf ( "quantity" , "popularity" )),
)
$response = $client -> setSettings (
'INDEX_NAME' ,
[ 'numericAttributesForFiltering' => [
'quantity' ,
'popularity' ,
],
],
);
response = client.set_settings(
index_name = "INDEX_NAME" ,
index_settings = {
"numericAttributesForFiltering" : [
"quantity" ,
"popularity" ,
],
},
)
response = client. set_settings (
"INDEX_NAME" ,
Algolia :: Search :: IndexSettings . new ( numeric_attributes_for_filtering: [ "quantity" , "popularity" ])
)
val response = Await .result(
client.setSettings(
indexName = "INDEX_NAME" ,
indexSettings = IndexSettings (
numericAttributesForFiltering = Some ( Seq ( "quantity" , "popularity" ))
)
),
Duration ( 100 , "sec" )
)
let response = try await client. setSettings (
indexName : "INDEX_NAME" ,
indexSettings : IndexSettings ( numericAttributesForFiltering : [ "quantity" , "popularity" ])
)
C#
Go
Java
JavaScript
Kotlin
PHP
Python
Ruby
Scala
Swift
IndexSettings settings = new IndexSettings ();
settings . NumericAttributesForFiltering = new List
{
"attribute1" ,
"popularity"
};
index . SetSettings ( settings );
res , err := index . SetSettings ( search . Settings {
NumericAttributesForFiltering : opt . NumericAttributesForFiltering (
"quantity" ,
"popularity" ,
),
})
index . setSettings (
new IndexSettings ()
. setNumericAttributesForFiltering (
Arrays . asList (
"quantity" ,
"popularity"
)
)
);
index
. setSettings ({
numericAttributesForFiltering: [ "quantity" , "popularity" ],
})
. then (() => {
// done
});
val settings = settings {
numericAttributesForFiltering {
+ "quantity"
+ "popularity"
}
}
index. setSettings (settings)
$index -> setSettings ([
'numericAttributesForFiltering' => [
'quantity' ,
'popularity'
]
]);
index.set_settings({ "numericAttributesForFiltering" : [ "quantity" , "popularity" ]})
index. set_settings (
{
numericAttributesForFiltering: [
"quantity" ,
"popularity"
]
}
)
client.execute {
setSettings of "myIndex" `with` IndexSettings (
numericAttributesForFiltering = Some ( Seq (
"quantity" ,
"popularity"
))
)
}
let settings = Settings ()
. set (\. numericAttributesForFiltering , to : [ "quantity" , "popularity" ])
index. setSettings (settings) { result in
if case . success ( let response) = result {
print ( "Response: \( response ) " )
}
}