< Back

New-AzureSearchField

Sat Jan 11, 2020 12:08 pm

NAME New-AzureSearchField



SYNOPSIS

Create new Azure Serach Field





SYNTAX

New-AzureSearchField [-Name] <String> [-Type] <String> [-Searchable] [-Filterable] [-Sortable] [-Facetable]

[-IsKey] [-Retrievable] [[-Analyzer] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

The New-AzureSearchField cmdlet lets create new Azure Serach field





PARAMETERS

-Name <String>

Azure Search field Name.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Type <String>

The data type for the field. See https://docs.microsoft.com/en-us/rest/a ... data-types

for more deatil.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Searchable [<SwitchParameter>]

Marks the field as full-text search-able. This means it will undergo analysis such as word-breaking during

indexing. If you set a searchable field to a value like "sunny day", internally it will be split into the

individual tokens "sunny" and "day". This enables full-text searches for these terms. Fields of type

Edm.String or Collection(Edm.String) are searchable by default. Fields of other types are not searchable.

Note: searchable fields consume extra space in your index since Azure Search will store an additional

tokenized version of the field value for full-text searches. If you want to save space in your index and you

don't need a field to be included in searches, set searchable to false.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Filterable [<SwitchParameter>]

Allows the field to be referenced in $filter queries. filterable differs from searchable in how strings are

handled. Fields of type Edm.String or Collection(Edm.String) that are filterable do not undergo word-breaking,

so comparisons are for exact matches only. For example, if you set such a field f to "sunny day", $filter=f eq

'sunny' will find no matches, but $filter=f eq 'sunny day' will. All fields are filterable by default.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Sortable [<SwitchParameter>]

By default the system sorts results by score, but in many experiences users will want to sort by fields in the

documents. Fields of type Collection(Edm.String) cannot be sortable. All other fields are sortable by default.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Facetable [<SwitchParameter>]

Typically used in a presentation of search results that includes hit count by category (e.g. search for

digital cameras and see hits by brand, by megapixels, by price, etc.). This option cannot be used with fields

of type Edm.GeographyPoint. All other fields are facetable by default. Note: Fields of type Edm.String that

are filterable, sortable, or facetable can be at most 32 kilobytes in length. This is because such fields are

treated as a single search term, and the maximum length of a term in Azure Search is 32K kilobytes. If you

need to store more text than this in a single string field, you will need to explicitly set filterable,

sortable, and facetable to false in your index definition. Note: If a field has none of the above attributes

set to true (searchable, filterable, sortable, facetable) the field is effectively excluded from the inverted

index. This option is useful for fields that are not used in queries, but are needed in search results.

Excluding such fields from the index improves performance.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-IsKey [<SwitchParameter>]

Marks the field as containing unique identifiers for documents within the index. Exactly one field must be

chosen as the key field and it must be of type Edm.String. Key fields can be used to look up documents

directly. See Lookup Document (Azure Search Service REST API) for details.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Retrievable [<SwitchParameter>]

Sets whether the field can be returned in a search result. This is useful when you want to use a field (e.g.,

margin) as a filter, sorting, or scoring mechanism but do not want the field to be visible to the end user.

This attribute must be true for key fields



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Analyzer <String>

Sets the name of the language analyzer to use for the field. For the allowed set of values see Language

support (Azure Search Service REST API). This option can be used only with searchable fields and it can't be

set together with either searchAnalyzer or indexAnalyzer. Once the analyzer is chosen, it cannot be changed

for the field.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>New-AzureSearchField -Name hotelId -Type Edm.String -isKey -Retrievable



This exmaple creates new key field as string type.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>New-AzureSearchField -Name baseRate -Type Edm.Double



This exmaple creates a field as double type.











RELATED LINKS