1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. sls
  5. getIndexs
Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi

alicloud.sls.getIndexs

Start a Neo task
Explain and create an alicloud.sls.getIndexs resource
alicloud logo
Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi

    This data source provides Sls Index available to the user.What is Index

    NOTE: Available since v1.262.0.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const logstoreName = config.get("logstoreName") || "logstore-example-1";
    const projectName = config.get("projectName") || "project-for-index-terraform-example-1";
    const defaultProject = new alicloud.log.Project("default", {
        description: "terraform example",
        projectName: projectName,
    });
    const defaultStore = new alicloud.log.Store("default", {
        hotTtl: 7,
        retentionPeriod: 30,
        shardCount: 2,
        projectName: defaultProject.projectName,
        logstoreName: logstoreName,
    });
    const defaultIndex = new alicloud.sls.Index("default", {
        line: {
            chn: true,
            caseSensitive: true,
            tokens: ["a"],
            excludeKeys: ["t"],
        },
        keys: JSON.stringify({
            example: {
                caseSensitive: false,
                token: [
                    "\n",
                    "\x09",
                    ",",
                    " ",
                    ";",
                    "\"",
                    "'",
                    "(",
                    ")",
                    "{",
                    "}",
                    "[",
                    "]",
                    "<",
                    ">",
                    "?",
                    "/",
                    "#",
                    ":",
                ],
                type: "text",
                doc_value: false,
                alias: "",
                chn: false,
            },
        }),
        logstoreName: defaultStore.logstoreName,
        projectName: projectName,
    });
    const _default = alicloud.sls.getIndexsOutput({
        logstoreName: defaultStore.logstoreName,
        projectName: defaultProject.projectName,
    });
    export const alicloudSlsIndexExampleId = _default.apply(_default => _default.indexs?.[0]?.id);
    
    import pulumi
    import json
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    logstore_name = config.get("logstoreName")
    if logstore_name is None:
        logstore_name = "logstore-example-1"
    project_name = config.get("projectName")
    if project_name is None:
        project_name = "project-for-index-terraform-example-1"
    default_project = alicloud.log.Project("default",
        description="terraform example",
        project_name=project_name)
    default_store = alicloud.log.Store("default",
        hot_ttl=7,
        retention_period=30,
        shard_count=2,
        project_name=default_project.project_name,
        logstore_name=logstore_name)
    default_index = alicloud.sls.Index("default",
        line={
            "chn": True,
            "case_sensitive": True,
            "tokens": ["a"],
            "exclude_keys": ["t"],
        },
        keys=json.dumps({
            "example": {
                "caseSensitive": False,
                "token": [
                    "\n",
                    "\x09",
                    ",",
                    " ",
                    ";",
                    "\"",
                    "'",
                    "(",
                    ")",
                    "{",
                    "}",
                    "[",
                    "]",
                    "<",
                    ">",
                    "?",
                    "/",
                    "#",
                    ":",
                ],
                "type": "text",
                "doc_value": False,
                "alias": "",
                "chn": False,
            },
        }),
        logstore_name=default_store.logstore_name,
        project_name=project_name)
    default = alicloud.sls.get_indexs_output(logstore_name=default_store.logstore_name,
        project_name=default_project.project_name)
    pulumi.export("alicloudSlsIndexExampleId", default.indexs[0].id)
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sls"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    cfg := config.New(ctx, "")
    name := "terraform-example";
    if param := cfg.Get("name"); param != ""{
    name = param
    }
    logstoreName := "logstore-example-1";
    if param := cfg.Get("logstoreName"); param != ""{
    logstoreName = param
    }
    projectName := "project-for-index-terraform-example-1";
    if param := cfg.Get("projectName"); param != ""{
    projectName = param
    }
    defaultProject, err := log.NewProject(ctx, "default", &log.ProjectArgs{
    Description: pulumi.String("terraform example"),
    ProjectName: pulumi.String(projectName),
    })
    if err != nil {
    return err
    }
    defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
    HotTtl: pulumi.Int(7),
    RetentionPeriod: pulumi.Int(30),
    ShardCount: pulumi.Int(2),
    ProjectName: defaultProject.ProjectName,
    LogstoreName: pulumi.String(logstoreName),
    })
    if err != nil {
    return err
    }
    tmpJSON0, err := json.Marshal(map[string]interface{}{
    "example": map[string]interface{}{
    "caseSensitive": false,
    "token": []string{
    "\n",
    "	",
    ",",
    " ",
    ";",
    "\"",
    "'",
    "(",
    ")",
    "{",
    "}",
    "[",
    "]",
    "<",
    ">",
    "?",
    "/",
    "#",
    ":",
    },
    "type": "text",
    "doc_value": false,
    "alias": "",
    "chn": false,
    },
    })
    if err != nil {
    return err
    }
    json0 := string(tmpJSON0)
    _, err = sls.NewIndex(ctx, "default", &sls.IndexArgs{
    Line: &sls.IndexLineArgs{
    Chn: pulumi.Bool(true),
    CaseSensitive: pulumi.Bool(true),
    Tokens: pulumi.StringArray{
    pulumi.String("a"),
    },
    ExcludeKeys: pulumi.StringArray{
    pulumi.String("t"),
    },
    },
    Keys: pulumi.String(json0),
    LogstoreName: defaultStore.LogstoreName,
    ProjectName: pulumi.String(projectName),
    })
    if err != nil {
    return err
    }
    _default := sls.GetIndexsOutput(ctx, sls.GetIndexsOutputArgs{
    LogstoreName: defaultStore.LogstoreName,
    ProjectName: defaultProject.ProjectName,
    }, nil);
    ctx.Export("alicloudSlsIndexExampleId", _default.ApplyT(func(_default sls.GetIndexsResult) (*string, error) {
    return &default.Indexs[0].Id, nil
    }).(pulumi.StringPtrOutput))
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var logstoreName = config.Get("logstoreName") ?? "logstore-example-1";
        var projectName = config.Get("projectName") ?? "project-for-index-terraform-example-1";
        var defaultProject = new AliCloud.Log.Project("default", new()
        {
            Description = "terraform example",
            ProjectName = projectName,
        });
    
        var defaultStore = new AliCloud.Log.Store("default", new()
        {
            HotTtl = 7,
            RetentionPeriod = 30,
            ShardCount = 2,
            ProjectName = defaultProject.ProjectName,
            LogstoreName = logstoreName,
        });
    
        var defaultIndex = new AliCloud.Sls.Index("default", new()
        {
            Line = new AliCloud.Sls.Inputs.IndexLineArgs
            {
                Chn = true,
                CaseSensitive = true,
                Tokens = new[]
                {
                    "a",
                },
                ExcludeKeys = new[]
                {
                    "t",
                },
            },
            Keys = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["example"] = new Dictionary<string, object?>
                {
                    ["caseSensitive"] = false,
                    ["token"] = new[]
                    {
                        @"
    ",
                        "	",
                        ",",
                        " ",
                        ";",
                        "\"",
                        "'",
                        "(",
                        ")",
                        "{",
                        "}",
                        "[",
                        "]",
                        "<",
                        ">",
                        "?",
                        "/",
                        "#",
                        ":",
                    },
                    ["type"] = "text",
                    ["doc_value"] = false,
                    ["alias"] = "",
                    ["chn"] = false,
                },
            }),
            LogstoreName = defaultStore.LogstoreName,
            ProjectName = projectName,
        });
    
        var @default = AliCloud.Sls.GetIndexs.Invoke(new()
        {
            LogstoreName = defaultStore.LogstoreName,
            ProjectName = defaultProject.ProjectName,
        });
    
        return new Dictionary<string, object?>
        {
            ["alicloudSlsIndexExampleId"] = @default.Apply(@default => @default.Apply(getIndexsResult => getIndexsResult.Indexs[0]?.Id)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.log.Project;
    import com.pulumi.alicloud.log.ProjectArgs;
    import com.pulumi.alicloud.log.Store;
    import com.pulumi.alicloud.log.StoreArgs;
    import com.pulumi.alicloud.sls.Index;
    import com.pulumi.alicloud.sls.IndexArgs;
    import com.pulumi.alicloud.sls.inputs.IndexLineArgs;
    import com.pulumi.alicloud.sls.SlsFunctions;
    import com.pulumi.alicloud.sls.inputs.GetIndexsArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var logstoreName = config.get("logstoreName").orElse("logstore-example-1");
            final var projectName = config.get("projectName").orElse("project-for-index-terraform-example-1");
            var defaultProject = new Project("defaultProject", ProjectArgs.builder()
                .description("terraform example")
                .projectName(projectName)
                .build());
    
            var defaultStore = new Store("defaultStore", StoreArgs.builder()
                .hotTtl(7)
                .retentionPeriod(30)
                .shardCount(2)
                .projectName(defaultProject.projectName())
                .logstoreName(logstoreName)
                .build());
    
            var defaultIndex = new Index("defaultIndex", IndexArgs.builder()
                .line(IndexLineArgs.builder()
                    .chn(true)
                    .caseSensitive(true)
                    .tokens("a")
                    .excludeKeys("t")
                    .build())
                .keys(serializeJson(
                    jsonObject(
                        jsonProperty("example", jsonObject(
                            jsonProperty("caseSensitive", false),
                            jsonProperty("token", jsonArray(
                                """
    
                                """, 
                                "	", 
                                ",", 
                                " ", 
                                ";", 
                                "\"", 
                                "'", 
                                "(", 
                                ")", 
                                "{", 
                                "}", 
                                "[", 
                                "]", 
                                "<", 
                                ">", 
                                "?", 
                                "/", 
                                "#", 
                                ":"
                            )),
                            jsonProperty("type", "text"),
                            jsonProperty("doc_value", false),
                            jsonProperty("alias", ""),
                            jsonProperty("chn", false)
                        ))
                    )))
                .logstoreName(defaultStore.logstoreName())
                .projectName(projectName)
                .build());
    
            final var default = SlsFunctions.getIndexs(GetIndexsArgs.builder()
                .logstoreName(defaultStore.logstoreName())
                .projectName(defaultProject.projectName())
                .build());
    
            ctx.export("alicloudSlsIndexExampleId", default_.applyValue(_default_ -> _default_.indexs()[0].id()));
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
      logstoreName:
        type: string
        default: logstore-example-1
      projectName:
        type: string
        default: project-for-index-terraform-example-1
    resources:
      defaultProject:
        type: alicloud:log:Project
        name: default
        properties:
          description: terraform example
          projectName: ${projectName}
      defaultStore:
        type: alicloud:log:Store
        name: default
        properties:
          hotTtl: '7'
          retentionPeriod: '30'
          shardCount: '2'
          projectName: ${defaultProject.projectName}
          logstoreName: ${logstoreName}
      defaultIndex:
        type: alicloud:sls:Index
        name: default
        properties:
          line:
            chn: 'true'
            caseSensitive: 'true'
            tokens:
              - a
            excludeKeys:
              - t
          keys:
            fn::toJSON:
              example:
                caseSensitive: false
                token:
                  - |2+
                  - "\t"
                  - ','
                  - ' '
                  - ;
                  - '"'
                  - ''''
                  - (
                  - )
                  - '{'
                  - '}'
                  - '['
                  - ']'
                  - <
                  - '>'
                  - '?'
                  - /
                  - '#'
                  - ':'
                type: text
                doc_value: false
                alias: ""
                chn: false
          logstoreName: ${defaultStore.logstoreName}
          projectName: ${projectName}
    variables:
      default:
        fn::invoke:
          function: alicloud:sls:getIndexs
          arguments:
            logstoreName: ${defaultStore.logstoreName}
            projectName: ${defaultProject.projectName}
    outputs:
      alicloudSlsIndexExampleId: ${default.indexs[0].id}
    

    Using getIndexs

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getIndexs(args: GetIndexsArgs, opts?: InvokeOptions): Promise<GetIndexsResult>
    function getIndexsOutput(args: GetIndexsOutputArgs, opts?: InvokeOptions): Output<GetIndexsResult>
    def get_indexs(ids: Optional[Sequence[str]] = None,
                   logstore_name: Optional[str] = None,
                   output_file: Optional[str] = None,
                   project_name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetIndexsResult
    def get_indexs_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   logstore_name: Optional[pulumi.Input[str]] = None,
                   output_file: Optional[pulumi.Input[str]] = None,
                   project_name: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetIndexsResult]
    func GetIndexs(ctx *Context, args *GetIndexsArgs, opts ...InvokeOption) (*GetIndexsResult, error)
    func GetIndexsOutput(ctx *Context, args *GetIndexsOutputArgs, opts ...InvokeOption) GetIndexsResultOutput

    > Note: This function is named GetIndexs in the Go SDK.

    public static class GetIndexs 
    {
        public static Task<GetIndexsResult> InvokeAsync(GetIndexsArgs args, InvokeOptions? opts = null)
        public static Output<GetIndexsResult> Invoke(GetIndexsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetIndexsResult> getIndexs(GetIndexsArgs args, InvokeOptions options)
    public static Output<GetIndexsResult> getIndexs(GetIndexsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: alicloud:sls/getIndexs:getIndexs
      arguments:
        # arguments dictionary

    The following arguments are supported:

    LogstoreName string
    Logstore name
    ProjectName string
    Project name
    Ids List<string>
    A list of Index IDs. The value is formulated as <project_name>:<logstore_name>.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    LogstoreName string
    Logstore name
    ProjectName string
    Project name
    Ids []string
    A list of Index IDs. The value is formulated as <project_name>:<logstore_name>.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    logstoreName String
    Logstore name
    projectName String
    Project name
    ids List<String>
    A list of Index IDs. The value is formulated as <project_name>:<logstore_name>.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    logstoreName string
    Logstore name
    projectName string
    Project name
    ids string[]
    A list of Index IDs. The value is formulated as <project_name>:<logstore_name>.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    logstore_name str
    Logstore name
    project_name str
    Project name
    ids Sequence[str]
    A list of Index IDs. The value is formulated as <project_name>:<logstore_name>.
    output_file str
    File name where to save data source results (after running pulumi preview).
    logstoreName String
    Logstore name
    projectName String
    Project name
    ids List<String>
    A list of Index IDs. The value is formulated as <project_name>:<logstore_name>.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getIndexs Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of Index IDs.
    Indexs List<Pulumi.AliCloud.Sls.Outputs.GetIndexsIndex>
    A list of Index Entries. Each element contains the following attributes:
    LogstoreName string
    ProjectName string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of Index IDs.
    Indexs []GetIndexsIndex
    A list of Index Entries. Each element contains the following attributes:
    LogstoreName string
    ProjectName string
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Index IDs.
    indexs List<GetIndexsIndex>
    A list of Index Entries. Each element contains the following attributes:
    logstoreName String
    projectName String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of Index IDs.
    indexs GetIndexsIndex[]
    A list of Index Entries. Each element contains the following attributes:
    logstoreName string
    projectName string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of Index IDs.
    indexs Sequence[GetIndexsIndex]
    A list of Index Entries. Each element contains the following attributes:
    logstore_name str
    project_name str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of Index IDs.
    indexs List<Property Map>
    A list of Index Entries. Each element contains the following attributes:
    logstoreName String
    projectName String
    outputFile String

    Supporting Types

    GetIndexsIndex

    Id string
    The ID of the resource supplied above.
    Keys string
    Field index
    Line Pulumi.AliCloud.Sls.Inputs.GetIndexsIndexLine
    Full-text index
    LogReduceBlackLists List<string>
    The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
    LogReduceWhiteLists List<string>
    The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
    MaxTextLen int
    Maximum length of statistical field
    Ttl int
    Log index storage time
    Id string
    The ID of the resource supplied above.
    Keys string
    Field index
    Line GetIndexsIndexLine
    Full-text index
    LogReduceBlackLists []string
    The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
    LogReduceWhiteLists []string
    The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
    MaxTextLen int
    Maximum length of statistical field
    Ttl int
    Log index storage time
    id String
    The ID of the resource supplied above.
    keys String
    Field index
    line GetIndexsIndexLine
    Full-text index
    logReduceBlackLists List<String>
    The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
    logReduceWhiteLists List<String>
    The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
    maxTextLen Integer
    Maximum length of statistical field
    ttl Integer
    Log index storage time
    id string
    The ID of the resource supplied above.
    keys string
    Field index
    line GetIndexsIndexLine
    Full-text index
    logReduceBlackLists string[]
    The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
    logReduceWhiteLists string[]
    The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
    maxTextLen number
    Maximum length of statistical field
    ttl number
    Log index storage time
    id str
    The ID of the resource supplied above.
    keys str
    Field index
    line GetIndexsIndexLine
    Full-text index
    log_reduce_black_lists Sequence[str]
    The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
    log_reduce_white_lists Sequence[str]
    The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
    max_text_len int
    Maximum length of statistical field
    ttl int
    Log index storage time
    id String
    The ID of the resource supplied above.
    keys String
    Field index
    line Property Map
    Full-text index
    logReduceBlackLists List<String>
    The blacklist of the cluster fields of log clustering is filtered only when log clustering is enabled.
    logReduceWhiteLists List<String>
    The whitelist of the cluster fields for log clustering. This filter is valid only when log clustering is enabled.
    maxTextLen Number
    Maximum length of statistical field
    ttl Number
    Log index storage time

    GetIndexsIndexLine

    CaseSensitive bool
    Is case sensitive.
    Chn bool
    Does it include Chinese.
    ExcludeKeys List<string>
    List of excluded fields.
    IncludeKeys List<string>
    Include field list.
    Tokens List<string>
    Delimiter.
    CaseSensitive bool
    Is case sensitive.
    Chn bool
    Does it include Chinese.
    ExcludeKeys []string
    List of excluded fields.
    IncludeKeys []string
    Include field list.
    Tokens []string
    Delimiter.
    caseSensitive Boolean
    Is case sensitive.
    chn Boolean
    Does it include Chinese.
    excludeKeys List<String>
    List of excluded fields.
    includeKeys List<String>
    Include field list.
    tokens List<String>
    Delimiter.
    caseSensitive boolean
    Is case sensitive.
    chn boolean
    Does it include Chinese.
    excludeKeys string[]
    List of excluded fields.
    includeKeys string[]
    Include field list.
    tokens string[]
    Delimiter.
    case_sensitive bool
    Is case sensitive.
    chn bool
    Does it include Chinese.
    exclude_keys Sequence[str]
    List of excluded fields.
    include_keys Sequence[str]
    Include field list.
    tokens Sequence[str]
    Delimiter.
    caseSensitive Boolean
    Is case sensitive.
    chn Boolean
    Does it include Chinese.
    excludeKeys List<String>
    List of excluded fields.
    includeKeys List<String>
    Include field list.
    tokens List<String>
    Delimiter.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.88.0 published on Saturday, Nov 1, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate