0.8.16 • Published 9 months ago

@enterprise_search/indexer v0.8.16

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Index

This is a tool to index content for elastic search or other search engines, and to provide support for Document Level Security (DLS). This means that we ensure only people that can see the original document can see the search result.

Installation

npm i -g @itsmworkspace/indexer # Needs to be run as a adminstrator or super user

Requirements:

  • Node.js 16 or higher (it might work with lower versions, but it is not tested)

Example usage

Indexing

The main command is index, and we use the indexer sub command.

index indexer index  # Just indexes all the data
index indexer index --api --keep # indexes all the data and launches an api for looking at metrics and keeps running when finished
index indexer index --since 1d # Just index things that have changed in the last day

Api Key Management

Remember to use --help to get more information on the commands especially command configuration (which user, the url, the username and password...)

Also be aware that the apiKeys are about 'an environment'. See the --help for more information

index apikey add email@example.com # Generates a DSL api key for the user, invalidating all other DSL api keys
index apikey api # creates an api with end point /apikey/email@welcome.com that returns the api key for the user (invalidating all others)
index apikey remove email@example.com # Invalidates all the DSL api keys for the user.
index apikey id email@example.com     # Shows all the data that the user can access with their api key 

Pushing data to elastic search

index es push # Pushes all the data to elastic search
index es push --help # Show options for the push command
index es push --elastic-search http://localhost:9200 # Pushes all the data to the elastic search at the given url

Configuration

There is a file call indexer.yaml that is used to configure the indexer. The file is located in the same directory as the indexer executable.

The file is in YAML format and has the following structure:

Defaults

The first section of the file is the defaults

defaults:
  # here we set defaults values. For example retry policies and throttles.
  query: # Here all the defaults for queries. The 'getting of data out of the source' for example out of Jira, or Confluence or gitlab...
    retryPolicy:
      initialInterval: 2000; # In milliseconds
      maximumInterval: 10000; # In milliseconds
      maximumAttempts: 5
      multiplier?: 2. # For exponential backoff. Default is 2
      nonRecoverableErrors?: string[]; // List of errors that should not be retried. 'Not Found' is the one commonly used
    throttle:
      max: 100  # Imagine tokens in a jar. This is the size of the jar. To do a request you need to take a token from the jar.
      tokensPer100ms: 0.1 # this is how many tokens are added to the jar every 100ms
      throttlingDelay: 50;    // Max random delay before retrying if have run out of tokens in ms defaults 50ms
      countOnTooManyErrors: -500 // If we get a 429 error we will set the number of tokens to this and also reduce the tokensPer100ms a bit
    auth: # see below of other options
      method: ApiKey
      credentials:
        apiKey: "{source}_APIKEY"
  target: # Now we have the defaults for the target. This is currently just storing a file system but I expect to add more
    retry: { } # Same as above 
    throttle: { } # Same as above. Probably not needed for the file system.
    file: "target/index/{index}/{name}_{num}.json" # The filename we write to
    max: 10000000 # The maximum number of documents in a file. When this is reached a new file is created

Sources

The next section is where we get data from. Here is a sample

index: # Must be the word index
  jiraAcl: # This is the name of the source. Other things like index name and type default to this
    scan: # Where we get the data from
      groupMembersFile: 'group.members.csv'
      index: '.search-acl-filter-jira-prod'
  jiraProd:
    type: jira
    scan:
      auth:
        method: 'ApiKey'
        credentials:
          apiKey: 'JIRA_PROD'
      index: jira-prod
      projects: "*"
      baseurl: "https://jira.eon.com/"
      apiVersion: "2"

Authorisation

export type EntraIdAuthentication = {
  method: 'EntraId';
  credentials: {
    tenantId?: string
    clientId: string;            // Public identifier for the app
    clientSecret: string;        // Secret used to authenticate the app and obtain tokens
    scope: string
  };
};
export type BasicAuthentication = {
  method: 'Basic';
  credentials: {
    username: string;
    password: string;
  };
};
export type ApiKeyAuthentication = {
  method: 'ApiKey';
  credentials: {
    apiKey: string;
  };
};
export type PrivateTokenAuthentication = {
  method: 'PrivateToken';
  credentials: {
    token: string;
  };
};
export type NoAuthentication = {
  method: 'none';
};

Tika

Apache Tika is used to process files such as PDFs, Word documents, etc. The configuration for Tika is as follows:

tika:
  jar: "../../../tika-server-standard-2.9.2.jar"
  protocol: http
  host: 127.0.0.1
  port: 9997

I think they are obvious in their meaning. Note that during indexing or similar operations the index launches the tika server using the jar, and kills it at the end.

Pipelines.yaml

Currently this is a second config file. We may merge it with indexer.yaml in the near future. It is used by commands like

index es makeIndexes                      # This will create the indexes in elastic search
index es pipeline                         # This will create the pipelines in elastic search
index es remakeIndicies --all             # This will delete all the indexes and recreate them.
index es remakeIndicies --index jira-prod # This will delete the index jira-prod and recreate it.
index es remakeIndicies --all --noPush    # This will delete all the indexes and recreate them but not push the data
  

This controls the 'digest pipeline' for elastic search

Here is a sample section

jira-prod-pipeline: # Because I messed up... known issue... this name is the name of the index with -pipeline on the end. Otherwise it doesn't work properly
  index: jira-prod
  fields:           # These fields will be included in the searches
    - issue
    - comments
    - description
    - priority
    - status
  shorten:         # clip the length of this field. This is so that you can store a summary but not all the data
     description: 200
  remove:          # And remove these fields from the index
    - comments
    - full_text
0.8.16

9 months ago

0.8.15

9 months ago

0.8.12

9 months ago

0.8.14

9 months ago

0.8.11

9 months ago

0.8.10

9 months ago

0.8.9

9 months ago

0.8.8

9 months ago

0.8.7

9 months ago

0.8.6

9 months ago

0.8.3

9 months ago

0.8.2

9 months ago

0.8.1

9 months ago

0.8.0

9 months ago

0.7.71

10 months ago

0.7.70

10 months ago

0.7.69

10 months ago

0.7.67

10 months ago

0.7.66

10 months ago

0.7.65

10 months ago

0.7.64

10 months ago

0.7.63

10 months ago

0.7.62

10 months ago

0.7.61

10 months ago

0.7.60

10 months ago

0.7.59

10 months ago

0.7.58

10 months ago

0.7.57

10 months ago

0.7.56

10 months ago

0.7.55

10 months ago

0.7.54

10 months ago

0.7.53

10 months ago

0.7.52

10 months ago

0.7.51

10 months ago

0.7.50

10 months ago

0.7.49

10 months ago

0.7.48

10 months ago

0.7.47

10 months ago

0.7.46

10 months ago

0.7.45

10 months ago

0.7.44

10 months ago

0.7.43

10 months ago

0.7.42

10 months ago

0.7.41

10 months ago

0.7.40

10 months ago

0.7.39

10 months ago

0.7.38

10 months ago

0.7.37

10 months ago

0.7.36

10 months ago

0.7.35

10 months ago

0.7.34

10 months ago

0.7.33

10 months ago

0.7.32

10 months ago

0.7.31

10 months ago

0.7.30

10 months ago

0.7.29

10 months ago

0.7.28

10 months ago

0.7.27

10 months ago

0.7.26

10 months ago

0.7.25

10 months ago

0.7.24

10 months ago

0.7.23

10 months ago

0.7.22

10 months ago

0.7.21

10 months ago

0.7.20

10 months ago

0.7.19

10 months ago

0.7.18

10 months ago

0.7.17

10 months ago

0.7.16

10 months ago

0.7.15

10 months ago

0.7.14

10 months ago

0.7.13

10 months ago

0.7.12

10 months ago

0.7.11

10 months ago

0.7.10

10 months ago

0.7.9

10 months ago

0.7.8

10 months ago

0.7.7

10 months ago

0.7.6

10 months ago

0.7.5

10 months ago

0.7.4

10 months ago

0.7.3

10 months ago

0.7.2

10 months ago

0.7.0

10 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.3

10 months ago

0.6.2

10 months ago

0.6.1

11 months ago

0.6.0

11 months ago

0.5.5

11 months ago

0.5.4

11 months ago

0.5.3

11 months ago

0.5.2

11 months ago

0.5.1

11 months ago

0.5.0

11 months ago

0.4.34

11 months ago

0.4.33

11 months ago

0.4.32

11 months ago

0.4.31

11 months ago

0.4.30

11 months ago

0.4.29

11 months ago

0.4.28

11 months ago

0.4.27

11 months ago

0.4.26

11 months ago

0.4.25

11 months ago

0.4.24

11 months ago

0.4.23

11 months ago

0.4.22

11 months ago

0.4.20

11 months ago

0.4.19

11 months ago

0.4.17

12 months ago

0.4.16

12 months ago

0.4.15

12 months ago

0.4.14

12 months ago

0.4.13

12 months ago

0.4.12

12 months ago

0.4.11

12 months ago

0.4.10

12 months ago

0.4.9

12 months ago

0.4.8

12 months ago

0.4.7

12 months ago

0.4.6

12 months ago

0.4.5

12 months ago

0.4.4

12 months ago

0.4.3

12 months ago

0.4.2

12 months ago

0.4.1

12 months ago

0.4.0

12 months ago

0.3.1

12 months ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.1

1 year ago