diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 2d28427..5c02d99 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -12,27 +12,27 @@ jobs: test_all: name: test_all env: - DOCKER_COMPOSE_VERSION: 1.29.2 - LUAROCKS: 2.2.2 + LUAROCKS: 3.11.1 ES_USERNAME: elastic - ES_PASSWORD: changeme + ES_PASSWORD: "Changeme12456!" ES_TEST_PROTOCOL: http ES_TEST_PORT: 9200 CACERT_PATH: ELASTIC_CREDS: PROTOCOL: HTTP strategy: + fail-fast: false matrix: # We test on four versions of Lua - lua: [lua5.1, lua5.2, lua5.3, luajit2.0] + lua: [lua5.1, lua5.2, lua5.3, lua5.4, luajit] # We're testing on three versions of Elastic: 7, 8 and the # Amazon Fork - OpenSearch 2.0 elastic: [el7, el8, os2] - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v4 with: - fetch-depth: 5 + fetch-depth: 6 submodules: recursive - name: Set dynamic env vars run: echo "CAFILE=$GITHUB_WORKSPACE/docker/certs/ca/ca.crt" >> $GITHUB_ENV @@ -41,10 +41,11 @@ jobs: run: echo "CACERT_PATH=--cacert $GITHUB_WORKSPACE/docker/certs/ca/ca.crt" >> $GITHUB_ENV - name: install dependencies run: sudo apt-get -y update && sudo apt-get install wget openssl -y - - name: install docker-compose - run: curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` > docker-compose && chmod +x docker-compose && sudo mv docker-compose /usr/local/bin - name: run elasticsearch - run: cd docker && docker-compose -f create-certs.yml up && cp docker-compose.yml.${{ matrix.elastic }} docker-compose.yml && docker-compose up -d && cd .. + run: cd docker && docker compose -f create-certs.yml up && cp docker-compose.yml.${{ matrix.elastic }} docker-compose.yml && docker compose up -d && cd .. + - name: output docker compose logs if the previous step failed + if: failure() + run: cd docker && docker compose logs && cd .. - name: setup test environment env: LUA: ${{ matrix.lua }} @@ -52,15 +53,15 @@ jobs: - name: Add lua things to path run: echo "$HOME/.lua:$HOME/.local/bin:$GITHUB_WORKSPACE/install/luarocks/bin" >> $GITHUB_PATH - name: install luarocks - run: luarocks install lunitx && luarocks install luacov && luarocks install luacov-coveralls && luarocks install luasec 0.7-1 + run: luarocks install lunitx && luarocks install luacov && luarocks install luacov-coveralls && luarocks install luasec - name: make the elasticsearch-lua rockspec - run: luarocks make rockspecs/elasticsearch-lua-1.0.11-1.rockspec + run: luarocks make rockspecs/elasticsearch-lua-1.0.12-1.rockspec - name: run the tests for el8 if: ${{ matrix.elastic == 'el8' }} env: ES_TEST_PROTOCOL: https ES_TEST_PORT: 19200 - ELASTIC_CREDS: -u elastic:changeme + ELASTIC_CREDS: -u ${{env.ES_USERNAME}}:${{env.ES_PASSWORD}} PROTOCOL: https run: cd tests && luarocks path >lpath.sh && source lpath.sh && lua run-tests.lua - name: run the tests for opensearch2 diff --git a/docker/.env b/docker/.env index e21f6a7..d18e988 100644 --- a/docker/.env +++ b/docker/.env @@ -1,2 +1,2 @@ CERTS_DIR=/usr/share/elasticsearch/config/certificates -ELASTIC_PASSWORD=changeme +ELASTIC_PASSWORD=Changeme12456! diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e3aebc0..a2b437a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,5 +1,3 @@ -version: '2.2' - services: os01: image: opensearchproject/opensearch:2.0.0 @@ -34,7 +32,7 @@ services: es02: container_name: es02 - image: docker.elastic.co/elasticsearch/elasticsearch:8.2.2 + image: docker.elastic.co/elasticsearch/elasticsearch:8.15.2 environment: - node.name=es02 - ELASTIC_PASSWORD=$ELASTIC_PASSWORD @@ -62,7 +60,7 @@ services: retries: 5 wait_until_ready: - image: docker.elastic.co/elasticsearch/elasticsearch:8.2.2 + image: docker.elastic.co/elasticsearch/elasticsearch:8.15.2 command: /usr/bin/true depends_on: {"es02": {"condition": "service_healthy"}} diff --git a/docker/docker-compose.yml.el7 b/docker/docker-compose.yml.el7 index da22e6d..939b056 100644 --- a/docker/docker-compose.yml.el7 +++ b/docker/docker-compose.yml.el7 @@ -1,5 +1,3 @@ -version: '2.2' - services: es01: container_name: es01 diff --git a/docker/docker-compose.yml.el8 b/docker/docker-compose.yml.el8 index 6bdcd25..6049b59 100644 --- a/docker/docker-compose.yml.el8 +++ b/docker/docker-compose.yml.el8 @@ -1,9 +1,7 @@ -version: '2.2' - services: es02: container_name: es02 - image: docker.elastic.co/elasticsearch/elasticsearch:8.2.2 + image: docker.elastic.co/elasticsearch/elasticsearch:8.15.2 environment: - node.name=es02 - ELASTIC_PASSWORD=$ELASTIC_PASSWORD diff --git a/docker/docker-compose.yml.os2 b/docker/docker-compose.yml.os2 index 0c7ac21..bf4cd95 100644 --- a/docker/docker-compose.yml.os2 +++ b/docker/docker-compose.yml.os2 @@ -1,11 +1,10 @@ -version: '2.2' - services: os01: - image: opensearchproject/opensearch:2.0.0 + image: opensearchproject/opensearch:2 container_name: os01 environment: - node.name=os01 + - OPENSEARCH_INITIAL_ADMIN_PASSWORD=$ELASTIC_PASSWORD - discovery.type=single-node - plugins.security.disabled=true - bootstrap.memory_lock=true # along with the memlock settings below, disables swapping diff --git a/rockspecs/elasticsearch-lua-1.0.12-1.rockspec b/rockspecs/elasticsearch-lua-1.0.12-1.rockspec new file mode 100644 index 0000000..a025978 --- /dev/null +++ b/rockspecs/elasticsearch-lua-1.0.12-1.rockspec @@ -0,0 +1,170 @@ +package = "elasticsearch-lua" +version = "1.0.12-1" +source = { + url = "git+https://github.com/PowerDNS/elasticsearch-lua", + tag = "v1.0.12" +} +description = { + summary = "Elasticsearch client for the Lua language", + detailed = [[ + This is an elasticsearch client written in Lua. In accordance with other official low level clients, the client accepts associative arrays in the form of lua table as parameters. It is a fork of the origina client written by DhavalKapil + ]], + homepage = "https://github.com/PowerDNS/elasticsearch-lua", + license = "MIT" +} +dependencies = { + "lua >= 5.1 <= 5.4", + "luasocket", + "lua-cjson = 2.1.0.10-1", + "lunitx", + "luasec" +} +build = { + type = "builtin", + modules = { + ["elasticsearch"] = "src/elasticsearch.lua", + ["elasticsearch.Nodes"] = "src/elasticsearch/Nodes.lua", + ["elasticsearch.Transport"] = "src/elasticsearch/Transport.lua", + ["elasticsearch.Tasks"] = "src/elasticsearch/Tasks.lua", + ["elasticsearch.Cluster"] = "src/elasticsearch/Cluster.lua", + ["elasticsearch.Snapshot"] = "src/elasticsearch/Snapshot.lua", + ["elasticsearch.Cat"] = "src/elasticsearch/Cat.lua", + ["elasticsearch.helpers"] = "src/elasticsearch/helpers.lua", + ["elasticsearch.Settings"] = "src/elasticsearch/Settings.lua", + ["elasticsearch.Logger"] = "src/elasticsearch/Logger.lua", + ["elasticsearch.parser"] = "src/elasticsearch/parser.lua", + ["elasticsearch.Indices"] = "src/elasticsearch/Indices.lua", + ["elasticsearch.Client"] = "src/elasticsearch/Client.lua", + + ["elasticsearch.connection.Connection"] = "src/elasticsearch/connection/Connection.lua", + + ["elasticsearch.selector.RoundRobinSelector"] = "src/elasticsearch/selector/RoundRobinSelector.lua", + ["elasticsearch.selector.Selector"] = "src/elasticsearch/selector/Selector.lua", + ["elasticsearch.selector.StickyRoundRobinSelector"] = "src/elasticsearch/selector/StickyRoundRobinSelector.lua", + ["elasticsearch.selector.RandomSelector"] = "src/elasticsearch/selector/RandomSelector.lua", + + ["elasticsearch.connectionpool.ConnectionPool"] = "src/elasticsearch/connectionpool/ConnectionPool.lua", + ["elasticsearch.connectionpool.StaticConnectionPool"] = "src/elasticsearch/connectionpool/StaticConnectionPool.lua", + ["elasticsearch.connectionpool.SniffConnectionPool"] = "src/elasticsearch/connectionpool/SniffConnectionPool.lua", + + ["elasticsearch.endpoints.MSearch"] = "src/elasticsearch/endpoints/MSearch.lua", + ["elasticsearch.endpoints.TermVectors"] = "src/elasticsearch/endpoints/TermVectors.lua", + ["elasticsearch.endpoints.Suggest"] = "src/elasticsearch/endpoints/Suggest.lua", + ["elasticsearch.endpoints.PutTemplate"] = "src/elasticsearch/endpoints/PutTemplate.lua", + ["elasticsearch.endpoints.Search"] = "src/elasticsearch/endpoints/Search.lua", + ["elasticsearch.endpoints.Bulk"] = "src/elasticsearch/endpoints/Bulk.lua", + ["elasticsearch.endpoints.SearchExists"] = "src/elasticsearch/endpoints/SearchExists.lua", + ["elasticsearch.endpoints.ReIndex"] = "src/elasticsearch/endpoints/ReIndex.lua", + ["elasticsearch.endpoints.Index"] = "src/elasticsearch/endpoints/Index.lua", + ["elasticsearch.endpoints.TemplateEndpoint"] = "src/elasticsearch/endpoints/TemplateEndpoint.lua", + ["elasticsearch.endpoints.GetTemplate"] = "src/elasticsearch/endpoints/GetTemplate.lua", + ["elasticsearch.endpoints.RenderSearchTemplate"] = "src/elasticsearch/endpoints/RenderSearchTemplate.lua", + ["elasticsearch.endpoints.Info"] = "src/elasticsearch/endpoints/Info.lua", + ["elasticsearch.endpoints.Delete"] = "src/elasticsearch/endpoints/Delete.lua", + ["elasticsearch.endpoints.SearchShards"] = "src/elasticsearch/endpoints/SearchShards.lua", + ["elasticsearch.endpoints.DeleteTemplate"] = "src/elasticsearch/endpoints/DeleteTemplate.lua", + ["elasticsearch.endpoints.Update"] = "src/elasticsearch/endpoints/Update.lua", + ["elasticsearch.endpoints.Get"] = "src/elasticsearch/endpoints/Get.lua", + ["elasticsearch.endpoints.Scroll"] = "src/elasticsearch/endpoints/Scroll.lua", + ["elasticsearch.endpoints.Explain"] = "src/elasticsearch/endpoints/Explain.lua", + ["elasticsearch.endpoints.MTermVectors"] = "src/elasticsearch/endpoints/MTermVectors.lua", + ["elasticsearch.endpoints.MGet"] = "src/elasticsearch/endpoints/MGet.lua", + ["elasticsearch.endpoints.SearchTemplate"] = "src/elasticsearch/endpoints/SearchTemplate.lua", + ["elasticsearch.endpoints.Count"] = "src/elasticsearch/endpoints/Count.lua", + ["elasticsearch.endpoints.Ping"] = "src/elasticsearch/endpoints/Ping.lua", + ["elasticsearch.endpoints.FieldStats"] = "src/elasticsearch/endpoints/FieldStats.lua", + ["elasticsearch.endpoints.Endpoint"] = "src/elasticsearch/endpoints/Endpoint.lua", + ["elasticsearch.endpoints.UpdateByQuery"] = "src/elasticsearch/endpoints/UpdateByQuery.lua", + ["elasticsearch.endpoints.Mlt"] = "src/elasticsearch/endpoints/Mlt.lua", + ["elasticsearch.endpoints.DeleteByQuery"] = "src/elasticsearch/endpoints/DeleteByQuery.lua", + + ["elasticsearch.endpoints.Cat.Aliases"] = "src/elasticsearch/endpoints/Cat/Aliases.lua", + ["elasticsearch.endpoints.Cat.Health"] = "src/elasticsearch/endpoints/Cat/Health.lua", + ["elasticsearch.endpoints.Cat.Nodes"] = "src/elasticsearch/endpoints/Cat/Nodes.lua", + ["elasticsearch.endpoints.Cat.NodeAttrs"] = "src/elasticsearch/endpoints/Cat/NodeAttrs.lua", + ["elasticsearch.endpoints.Cat.PendingTasks"] = "src/elasticsearch/endpoints/Cat/PendingTasks.lua", + ["elasticsearch.endpoints.Cat.Allocation"] = "src/elasticsearch/endpoints/Cat/Allocation.lua", + ["elasticsearch.endpoints.Cat.CatEndpoint"] = "src/elasticsearch/endpoints/Cat/CatEndpoint.lua", + ["elasticsearch.endpoints.Cat.Recovery"] = "src/elasticsearch/endpoints/Cat/Recovery.lua", + ["elasticsearch.endpoints.Cat.FieldData"] = "src/elasticsearch/endpoints/Cat/FieldData.lua", + ["elasticsearch.endpoints.Cat.Snapshots"] = "src/elasticsearch/endpoints/Cat/Snapshots.lua", + ["elasticsearch.endpoints.Cat.ThreadPool"] = "src/elasticsearch/endpoints/Cat/ThreadPool.lua", + ["elasticsearch.endpoints.Cat.Segments"] = "src/elasticsearch/endpoints/Cat/Segments.lua", + ["elasticsearch.endpoints.Cat.Repositories"] = "src/elasticsearch/endpoints/Cat/Repositories.lua", + ["elasticsearch.endpoints.Cat.Count"] = "src/elasticsearch/endpoints/Cat/Count.lua", + ["elasticsearch.endpoints.Cat.Master"] = "src/elasticsearch/endpoints/Cat/Master.lua", + ["elasticsearch.endpoints.Cat.Indices"] = "src/elasticsearch/endpoints/Cat/Indices.lua", + ["elasticsearch.endpoints.Cat.Shards"] = "src/elasticsearch/endpoints/Cat/Shards.lua", + ["elasticsearch.endpoints.Cat.Plugins"] = "src/elasticsearch/endpoints/Cat/Plugins.lua", + ["elasticsearch.endpoints.Cat.Help"] = "src/elasticsearch/endpoints/Cat/Help.lua", + + ["elasticsearch.endpoints.Cluster.Health"] = "src/elasticsearch/endpoints/Cluster/Health.lua", + ["elasticsearch.endpoints.Cluster.PendingTasks"] = "src/elasticsearch/endpoints/Cluster/PendingTasks.lua", + ["elasticsearch.endpoints.Cluster.Stats"] = "src/elasticsearch/endpoints/Cluster/Stats.lua", + ["elasticsearch.endpoints.Cluster.Reroute"] = "src/elasticsearch/endpoints/Cluster/Reroute.lua", + ["elasticsearch.endpoints.Cluster.State"] = "src/elasticsearch/endpoints/Cluster/State.lua", + ["elasticsearch.endpoints.Cluster.GetSettings"] = "src/elasticsearch/endpoints/Cluster/GetSettings.lua", + ["elasticsearch.endpoints.Cluster.PutSettings"] = "src/elasticsearch/endpoints/Cluster/PutSettings.lua", + + ["elasticsearch.endpoints.Indices.Open"] = "src/elasticsearch/endpoints/Indices/Open.lua", + ["elasticsearch.endpoints.Indices.GetFieldMapping"] = "src/elasticsearch/endpoints/Indices/GetFieldMapping.lua", + ["elasticsearch.endpoints.Indices.DeleteAlias"] = "src/elasticsearch/endpoints/Indices/DeleteAlias.lua", + ["elasticsearch.endpoints.Indices.Status"] = "src/elasticsearch/endpoints/Indices/Status.lua", + ["elasticsearch.endpoints.Indices.GetUpgrade"] = "src/elasticsearch/endpoints/Indices/GetUpgrade.lua", + ["elasticsearch.endpoints.Indices.Refresh"] = "src/elasticsearch/endpoints/Indices/Refresh.lua", + ["elasticsearch.endpoints.Indices.IndicesEndpoint"] = "src/elasticsearch/endpoints/Indices/IndicesEndpoint.lua", + ["elasticsearch.endpoints.Indices.PutTemplate"] = "src/elasticsearch/endpoints/Indices/PutTemplate.lua", + ["elasticsearch.endpoints.Indices.Close"] = "src/elasticsearch/endpoints/Indices/Close.lua", + ["elasticsearch.endpoints.Indices.ExistsAlias"] = "src/elasticsearch/endpoints/Indices/ExistsAlias.lua", + ["elasticsearch.endpoints.Indices.Create"] = "src/elasticsearch/endpoints/Indices/Create.lua", + ["elasticsearch.endpoints.Indices.GetMapping"] = "src/elasticsearch/endpoints/Indices/GetMapping.lua", + ["elasticsearch.endpoints.Indices.GetTemplate"] = "src/elasticsearch/endpoints/Indices/GetTemplate.lua", + ["elasticsearch.endpoints.Indices.Stats"] = "src/elasticsearch/endpoints/Indices/Stats.lua", + ["elasticsearch.endpoints.Indices.GetAliases"] = "src/elasticsearch/endpoints/Indices/GetAliases.lua", + ["elasticsearch.endpoints.Indices.UpdateAliases"] = "src/elasticsearch/endpoints/Indices/UpdateAliases.lua", + ["elasticsearch.endpoints.Indices.Recovery"] = "src/elasticsearch/endpoints/Indices/Recovery.lua", + ["elasticsearch.endpoints.Indices.Delete"] = "src/elasticsearch/endpoints/Indices/Delete.lua", + ["elasticsearch.endpoints.Indices.ValidateQuery"] = "src/elasticsearch/endpoints/Indices/ValidateQuery.lua", + ["elasticsearch.endpoints.Indices.Exists"] = "src/elasticsearch/endpoints/Indices/Exists.lua", + ["elasticsearch.endpoints.Indices.ClearCache"] = "src/elasticsearch/endpoints/Indices/ClearCache.lua", + ["elasticsearch.endpoints.Indices.PostUpgrade"] = "src/elasticsearch/endpoints/Indices/PostUpgrade.lua", + ["elasticsearch.endpoints.Indices.DeleteTemplate"] = "src/elasticsearch/endpoints/Indices/DeleteTemplate.lua", + ["elasticsearch.endpoints.Indices.Segments"] = "src/elasticsearch/endpoints/Indices/Segments.lua", + ["elasticsearch.endpoints.Indices.Get"] = "src/elasticsearch/endpoints/Indices/Get.lua", + ["elasticsearch.endpoints.Indices.GetSettings"] = "src/elasticsearch/endpoints/Indices/GetSettings.lua", + ["elasticsearch.endpoints.Indices.PutSettings"] = "src/elasticsearch/endpoints/Indices/PutSettings.lua", + ["elasticsearch.endpoints.Indices.ExistsTemplate"] = "src/elasticsearch/endpoints/Indices/ExistsTemplate.lua", + ["elasticsearch.endpoints.Indices.DeleteMapping"] = "src/elasticsearch/endpoints/Indices/DeleteMapping.lua", + ["elasticsearch.endpoints.Indices.GetAlias"] = "src/elasticsearch/endpoints/Indices/GetAlias.lua", + ["elasticsearch.endpoints.Indices.Analyze"] = "src/elasticsearch/endpoints/Indices/Analyze.lua", + ["elasticsearch.endpoints.Indices.PutAlias"] = "src/elasticsearch/endpoints/Indices/PutAlias.lua", + ["elasticsearch.endpoints.Indices.Optimize"] = "src/elasticsearch/endpoints/Indices/Optimize.lua", + ["elasticsearch.endpoints.Indices.ShardStores"] = "src/elasticsearch/endpoints/Indices/ShardStores.lua", + ["elasticsearch.endpoints.Indices.PutMapping"] = "src/elasticsearch/endpoints/Indices/PutMapping.lua", + ["elasticsearch.endpoints.Indices.ForceMerge"] = "src/elasticsearch/endpoints/Indices/ForceMerge.lua", + ["elasticsearch.endpoints.Indices.Flush"] = "src/elasticsearch/endpoints/Indices/Flush.lua", + ["elasticsearch.endpoints.Indices.Seal"] = "src/elasticsearch/endpoints/Indices/Seal.lua", + + ["elasticsearch.endpoints.Nodes.Stats"] = "src/elasticsearch/endpoints/Nodes/Stats.lua", + ["elasticsearch.endpoints.Nodes.Info"] = "src/elasticsearch/endpoints/Nodes/Info.lua", + ["elasticsearch.endpoints.Nodes.HotThreads"] = "src/elasticsearch/endpoints/Nodes/HotThreads.lua", + ["elasticsearch.endpoints.Nodes.Shutdown"] = "src/elasticsearch/endpoints/Nodes/Shutdown.lua", + ["elasticsearch.endpoints.Nodes.NodesEndpoint"] = "src/elasticsearch/endpoints/Nodes/NodesEndpoint.lua", + + ["elasticsearch.endpoints.Snapshot.Status"] = "src/elasticsearch/endpoints/Snapshot/Status.lua", + ["elasticsearch.endpoints.Snapshot.SnapshotEndpoint"] = "src/elasticsearch/endpoints/Snapshot/SnapshotEndpoint.lua", + ["elasticsearch.endpoints.Snapshot.Create"] = "src/elasticsearch/endpoints/Snapshot/Create.lua", + ["elasticsearch.endpoints.Snapshot.VerifyRepository"] = "src/elasticsearch/endpoints/Snapshot/VerifyRepository.lua", + ["elasticsearch.endpoints.Snapshot.Restore"] = "src/elasticsearch/endpoints/Snapshot/Restore.lua", + ["elasticsearch.endpoints.Snapshot.Delete"] = "src/elasticsearch/endpoints/Snapshot/Delete.lua", + ["elasticsearch.endpoints.Snapshot.Get"] = "src/elasticsearch/endpoints/Snapshot/Get.lua", + ["elasticsearch.endpoints.Snapshot.DeleteRepository"] = "src/elasticsearch/endpoints/Snapshot/DeleteRepository.lua", + ["elasticsearch.endpoints.Snapshot.GetRepository"] = "src/elasticsearch/endpoints/Snapshot/GetRepository.lua", + ["elasticsearch.endpoints.Snapshot.CreateRepository"] = "src/elasticsearch/endpoints/Snapshot/CreateRepository.lua", + + ["elasticsearch.endpoints.Tasks.Cancel"] = "src/elasticsearch/endpoints/Tasks/Cancel.lua", + ["elasticsearch.endpoints.Tasks.Get"] = "src/elasticsearch/endpoints/Tasks/Get.lua", + ["elasticsearch.endpoints.Tasks.TasksEndpoint"] = "src/elasticsearch/endpoints/Tasks/TasksEndpoint.lua" + }, + copy_directories = {"tests"} +} diff --git a/src/elasticsearch/Client.lua b/src/elasticsearch/Client.lua index 17630b9..2a27634 100644 --- a/src/elasticsearch/Client.lua +++ b/src/elasticsearch/Client.lua @@ -54,9 +54,6 @@ function Client:requestEndpoint(endpoint, params, endpointParams) endpointParams = endpointParams or {} } if params ~= nil then - -- Elasticsearch 6+ are removing support for types - -- This removes it if it is set - params.type = nil -- Parameters need to be set local err = endpoint:setParams(params) if err ~= nil then @@ -309,57 +306,6 @@ function Client:count(params) return self:requestEndpoint("Count", params) end -------------------------------------------------------------------------------- --- Count Percolator --- --- @usage --- params["index"] = (string) The index of the document being count percolated. (Required) --- ["type"] = (string) The type of the document being count percolated. (Required) --- ["id"] = (string) Substitute the document in the request body with a document that is --- known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document --- from within the cluster. (Required) --- ["routing"] = (list) A comma-separated list of specific routing values --- ["preference"] = (string) Specify the node or shard the operation should be performed on --- ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable --- (missing or closed) --- ["allow_no_indices"] = (boolean) Whether to ignore if a wildcard indices expression resolves into no --- concrete indices. (This includes '_all' string or when no indices have been specified) --- ["expand_wildcards"] = (enum) Whether to expand wildcard expression to concrete indices that are open, --- ["percolate_index"] = (string) The index to count percolate the document into. Defaults to index. --- ["percolate_type"] = (string) The type to count percolate document into. Defaults to type. --- ["version"] = (number) Explicit version number for concurrency control --- ["version_type"] = (enum) Specific version type (internal,external,external_gte,force) --- ["body"] = The count percolator request definition using the percolate DSL --- --- @param params The countPercolate Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Client:countPercolate(params) - return self:requestEndpoint("CountPercolate", params) -end - -------------------------------------------------------------------------------- --- Function to implement mpercolate --- --- @usage --- params["index"] = (string) The index of the document being count percolated to use as default --- ["type"] = (string) The type of the document being percolated to use as default. --- ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable --- (missing or closed) --- ["allow_no_indices"] = (boolean) Whether to ignore if a wildcard indices expression resolves into no --- concrete indices. (This includes '_all' string or when no indices have been specified) --- ["expand_wildcards"] = (enum) Whether to expand wildcard expression to concrete indices that are open, --- ["body"] = The percolate request definitions (header & body pair), separated by newlines --- --- @param params The mpercolate Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Client:mpercolate(params) - return self:requestEndpoint("MPercolate", params) -end - ------------------------------------------------------------------------------- -- Function to implement mtermvectors -- @@ -432,39 +378,6 @@ function Client:mlt(params) return self:requestEndpoint("Mlt", params) end -------------------------------------------------------------------------------- --- Function to implement percolate --- --- @usage --- params["index"] = (string) The index of the document being percolated. (Required) --- ["type"] = (string) The type of the document being percolated. (Required) --- ["id"] = (string) Substitute the document in the request body with a document that is --- known by the specified id. On top of the id, the index and type parameter will be used to retrieve the document --- from within the cluster. (Required) --- ["routing"] = (list) A comma-separated list of specific routing values --- ["preference"] = (string) Specify the node or shard the operation should be performed on --- ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when --- unavailable (missing or closed) --- ["allow_no_indices"] = (boolean) Whether to ignore if a wildcard indices expression resolves into no --- concrete indices. (This includes '_all' string or when no indices have been specified) --- ["expand_wildcards"] = (enum) Whether to expand wildcard expression to concrete indices that are --- ["percolate_index"] = (string) The index to percolate the document into. Defaults to index. --- ["percolate_type"] = (string) The type to percolate document into. Defaults to type. --- ["percolate_routing"] = (string) The routing value to use when percolating the existing document. --- ["percolate_preference"] = (string) Which shard to prefer when executing the percolate request. --- ["percolate_format"] = (enum) Return an array of matching query IDs instead of objects (ids) --- ["version"] = (number) Explicit version number for concurrency control --- ["version_type"] = (enum) Specific version type (internal,external,external_gte,force) --- ["body"] = The percolator request definition using the percolate DSL --- --- @param params The percolate Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Client:percolate(params) - return self:requestEndpoint("Percolate", params) -end - ------------------------------------------------------------------------------- -- Function to search a particular document -- @@ -699,7 +612,6 @@ end -- ["id"] = (string) Specific document ID (when the POST method is used) -- ["consistency"] = (enum) Explicit write consistency setting for the operation -- ["parent"] = (string) ID of the parent document --- ["percolate"] = (string) Percolator queries to execute while indexing the document -- ["refresh"] = (boolean) Refresh the index after performing the operation -- ["replication"] = (enum) Specific replication type -- ["routing"] = (string) Specific routing value @@ -801,7 +713,6 @@ end -- ["fields"] = (list) A comma-separated list of fields to return in the response -- ["lang"] = (string) The script language (default: mvel) -- ["parent"] = (string) ID of the parent document --- ["percolate"] = (string) Perform percolation during the operation; use specific registered query name, attribute, or wildcard -- ["refresh"] = (boolean) Refresh the index after performing the operation -- ["replication"] = (enum) Specific replication type -- ["retry_on_conflict"] = (number) Specify how many times should the operation be retried when a conflict occurs (default: 0) diff --git a/src/elasticsearch/Indices.lua b/src/elasticsearch/Indices.lua index 7bdd8f7..d367c7e 100644 --- a/src/elasticsearch/Indices.lua +++ b/src/elasticsearch/Indices.lua @@ -429,40 +429,6 @@ function Indices:putTemplate(params) return self:requestEndpoint("PutTemplate", params) end -------------------------------------------------------------------------------- --- Exists Type function --- --- @usage --- params["index"] = (list) A comma-separated list of index names; use '_all' to check the types --- across all indices (Required) --- ["type"] = (list) A comma-separated list of document types to check (Required) --- ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable --- (missing or closed) --- ["allow_no_indices"] = (boolean) Whether to ignore if a wildcard indices expression resolves into no --- concrete indices. (This includes '_all' string or when no indices have been specified) --- ["expand_wildcards"] = (enum) Whether to expand wildcard expression to concrete indices that are open, --- closed or both. (open,closed,none,all) (default: open) --- ["local"] = (boolean) Return local information, do not retrieve the state from master node --- (default: false) --- --- @param params The put template Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Indices:existsType(params) - local temp, err = self:requestEndpoint("ExistsType", params) - if err == 200 then - -- Successfull request - return true - elseif err:match("Invalid response code") then - -- Wrong response code - return false - else - -- Some other error, notify user - return nil, err - end -end - ------------------------------------------------------------------------------- -- Get Upgrade function -- @@ -556,82 +522,6 @@ function Indices:validateQuery(params) return self:requestEndpoint("ValidateQuery", params) end -------------------------------------------------------------------------------- --- Delete Warmer function --- --- @usage --- params["index"] = (list) A comma-separated list of index names to delete warmers from (supports --- wildcards); use '_all' to perform the operation on all indices. (Required) --- ["name"] = (list) A comma-separated list of warmer names to delete (supports wildcards); use --- '_all' to delete all warmers in the specified indices. You must specify a name either in the uri or in the --- parameters. --- ["master_timeout"] = (time) Specify timeout for connection to master --- --- @param params The delete warmer Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Indices:deleteWarmer(params) - return self:requestEndpoint("DeleteWarmer", params) -end - -------------------------------------------------------------------------------- --- Get Warmer function --- --- @usage --- params["index"] = (list) A comma-separated list of index names to restrict the operation; use --- '_all' to perform the operation on all indices --- ["name"] = (list) The name of the warmer (supports wildcards); leave empty to get all --- warmers --- ["type"] = (list) A comma-separated list of document types to restrict the operation; leave --- empty to perform the operation on all types --- ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable --- (missing or closed) --- ["allow_no_indices"] = (boolean) Whether to ignore if a wildcard indices expression resolves into no --- concrete indices. (This includes '_all' string or when no indices have been specified) --- ["expand_wildcards"] = (enum) Whether to expand wildcard expression to concrete indices that are open, --- closed or both. (open,closed,none,all) (default: open) --- ["local"] = (boolean) Return local information, do not retrieve the state from master node --- (default: false) --- --- @param params The get warmer Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Indices:getWarmer(params) - return self:requestEndpoint("GetWarmer", params) -end - -------------------------------------------------------------------------------- --- Put Warmer function --- --- @usage --- params["index"] = (list) A comma-separated list of index names to register the warmer for; use --- '_all' or omit to perform the operation on all indices --- ["name"] = (string) The name of the warmer (Required) --- ["type"] = (list) A comma-separated list of document types to register the warmer for; --- leave empty to perform the operation on all types --- ["master_timeout"] = (time) Specify timeout for connection to master --- ["ignore_unavailable"] = (boolean) Whether specified concrete indices should be ignored when unavailable --- (missing or closed) in the search request to warm --- ["allow_no_indices"] = (boolean) Whether to ignore if a wildcard indices expression resolves into no --- concrete indices in the search request to warm. (This includes '_all' string or when no indices have been --- specified) --- ["expand_wildcards"] = (enum) Whether to expand wildcard expression to concrete indices that are open, --- closed or both, in the search request to warm. (open,closed,none,all) (default: open) --- ["request_cache"] = (boolean) Specify whether the request to be warmed should use the request cache, --- defaults to index level setting --- ["body"] = The search request definition for the warmer (query, filters, facets, sorting, --- etc) --- --- @param params The put warmer Parameters --- --- @return table Error or the data received from the elasticsearch server -------------------------------------------------------------------------------- -function Indices:putWarmer(params) - return self:requestEndpoint("PutWarmer", params) -end - ------------------------------------------------------------------------------- -- Function to check whether an index exists or not -- diff --git a/src/elasticsearch/endpoints/Bulk.lua b/src/elasticsearch/endpoints/Bulk.lua index 9b5deb4..211ef3b 100644 --- a/src/elasticsearch/endpoints/Bulk.lua +++ b/src/elasticsearch/endpoints/Bulk.lua @@ -40,12 +40,8 @@ end ------------------------------------------------------------------------------- function Bulk:getUri() local uri = "/_bulk" - if self.index ~= nil and self.type ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then + if self.index ~= nil then uri = "/" .. self.index .. uri - elseif self.type ~= nil then - uri = "/_all/" .. self.type .. uri end return uri end diff --git a/src/elasticsearch/endpoints/Count.lua b/src/elasticsearch/endpoints/Count.lua index 3001f7f..cab1418 100644 --- a/src/elasticsearch/endpoints/Count.lua +++ b/src/elasticsearch/endpoints/Count.lua @@ -52,9 +52,6 @@ function Count:getUri() else uri = uri .. "/" .. self.index end - if self.type ~= nil then - uri = uri .. "/" .. self.type - end uri = uri .. "/_count" return uri end diff --git a/src/elasticsearch/endpoints/CountPercolate.lua b/src/elasticsearch/endpoints/CountPercolate.lua deleted file mode 100644 index 37fb887..0000000 --- a/src/elasticsearch/endpoints/CountPercolate.lua +++ /dev/null @@ -1,67 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local Endpoint = require "elasticsearch.endpoints.Endpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local CountPercolate = Endpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- The parameters that are allowed to be used in params -CountPercolate.allowedParams = { - ["routing"]= true, - ["preference"]= true, - ["ignore_unavailable"]= true, - ["allow_no_indices"]= true, - ["expand_wildcards"]= true, - ["percolate_index"]= true, - ["percolate_type"]= true, - ["version"]= true, - ["version_type"]= true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function CountPercolate:getMethod() - return "GET" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function CountPercolate:getUri() - if self.index == nil then - return nil, "index not specified for CountPercolate" - end - if self.type == nil then - return nil, "type not specified for CountPercolate" - end - local uri = "/" .. self.index .. "/" .. self.type - if self.id ~= nil then - uri = uri .. "/" .. self.id - end - uri = uri .. "/_percolate/count" - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of CountPercolate class -------------------------------------------------------------------------------- -function CountPercolate:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return CountPercolate diff --git a/src/elasticsearch/endpoints/DeleteByQuery.lua b/src/elasticsearch/endpoints/DeleteByQuery.lua index a9d7fb4..b0323f4 100644 --- a/src/elasticsearch/endpoints/DeleteByQuery.lua +++ b/src/elasticsearch/endpoints/DeleteByQuery.lua @@ -45,12 +45,9 @@ end ------------------------------------------------------------------------------- function DeleteByQuery:getUri() if self.index == nil then - return nil, "index not specified for CountPercolate" + return nil, "index not specified for DeleteByQuery" end local uri = "/" .. self.index - if self.type ~= nil then - uri = uri .. "/" .. self.type - end uri = uri .. "/_query" return uri end diff --git a/src/elasticsearch/endpoints/Endpoint.lua b/src/elasticsearch/endpoints/Endpoint.lua index 508ac1e..1831195 100644 --- a/src/elasticsearch/endpoints/Endpoint.lua +++ b/src/elasticsearch/endpoints/Endpoint.lua @@ -73,7 +73,6 @@ end function Endpoint:setParams(params) -- Clearing existing parameters self.index = nil - self.type = nil self.id = nil self.params = {} self.body = nil @@ -81,8 +80,6 @@ function Endpoint:setParams(params) for i, v in pairs(params) do if i == "index" then self.index = v - elseif i == "type" then - self.type = v elseif i == "id" then self.id = v elseif i == "body" then diff --git a/src/elasticsearch/endpoints/Explain.lua b/src/elasticsearch/endpoints/Explain.lua index b28d519..d24b752 100644 --- a/src/elasticsearch/endpoints/Explain.lua +++ b/src/elasticsearch/endpoints/Explain.lua @@ -52,10 +52,7 @@ function Explain:getUri() if self.index == nil then return nil, "index not specified for Explain" end - if self.type == nil then - return nil, "type not specified for Explain" - end - return "/" .. self.index .. "/" .. self.type .. "/" .. self.id .. "/_explain" + return "/" .. self.index .. "/" .. self.id .. "/_explain" end ------------------------------------------------------------------------------- diff --git a/src/elasticsearch/endpoints/Index.lua b/src/elasticsearch/endpoints/Index.lua index 5de8267..0678a01 100644 --- a/src/elasticsearch/endpoints/Index.lua +++ b/src/elasticsearch/endpoints/Index.lua @@ -53,7 +53,7 @@ function Index:getUri() end local uri = "/" .. self.index .. "/_doc" if self.id ~= nil then - uri = uri .. "/" .. self.id + uri = uri .. "/" .. self.id end if self.endpointParams.createIfAbsent == true then self.params["op_type"] = "create" diff --git a/src/elasticsearch/endpoints/Indices/DeleteMapping.lua b/src/elasticsearch/endpoints/Indices/DeleteMapping.lua index 0126aba..e1a10e0 100644 --- a/src/elasticsearch/endpoints/Indices/DeleteMapping.lua +++ b/src/elasticsearch/endpoints/Indices/DeleteMapping.lua @@ -35,10 +35,7 @@ function DeleteMapping:getUri() if self.index == nil then return nil, "index not specified for Delete Mapping" end - if self.type == nil then - return nil, "type not specified for Delete Mapping" - end - return "/" .. self.index .. "/" .. self.type .. "/_mapping" + return "/" .. self.index .. "/_mapping" end ------------------------------------------------------------------------------- diff --git a/src/elasticsearch/endpoints/Indices/DeleteWarmer.lua b/src/elasticsearch/endpoints/Indices/DeleteWarmer.lua deleted file mode 100644 index 1ef530d..0000000 --- a/src/elasticsearch/endpoints/Indices/DeleteWarmer.lua +++ /dev/null @@ -1,55 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local IndicesEndpoint = require "elasticsearch.endpoints.Indices.IndicesEndpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local DeleteWarmer = IndicesEndpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- The parameters that are allowed to be used in params -DeleteWarmer.allowedParams = { - ["name"] = true, - ["master_timeout"] = true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function DeleteWarmer:getMethod() - return "DELETE" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function DeleteWarmer:getUri() - if self.index == nil then - return nil, "index not specified for Delete Warmer" - elseif self.name == nil then - return nil, "name not specified for Delete Warmer" - end - local uri = "/" .. self.index .. "/_warmer/" .. self.name - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of DeleteWarmer class -------------------------------------------------------------------------------- -function DeleteWarmer:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return DeleteWarmer diff --git a/src/elasticsearch/endpoints/Indices/ExistsType.lua b/src/elasticsearch/endpoints/Indices/ExistsType.lua deleted file mode 100644 index b2e6d2c..0000000 --- a/src/elasticsearch/endpoints/Indices/ExistsType.lua +++ /dev/null @@ -1,58 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local IndicesEndpoint = require "elasticsearch.endpoints.Indices.IndicesEndpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local ExistsType = IndicesEndpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- The parameters that are allowed to be used in params -ExistsType.allowedParams = { - ["ignore_unavailable"] = true, - ["allow_no_indices"] = true, - ["expand_wildcards"] = true, - ["local"] = true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function ExistsType:getMethod() - return "HEAD" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function ExistsType:getUri() - if self.index == nil then - return nil, "index not specified for Exists Type" - end - if self.type == nil then - return nil, "type not specified for Exists Type" - end - local uri = "/" .. self.index .. "/" .. self.type - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of ExistsType class -------------------------------------------------------------------------------- -function ExistsType:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return ExistsType diff --git a/src/elasticsearch/endpoints/Indices/GetFieldMapping.lua b/src/elasticsearch/endpoints/Indices/GetFieldMapping.lua index da504bd..4c45107 100644 --- a/src/elasticsearch/endpoints/Indices/GetFieldMapping.lua +++ b/src/elasticsearch/endpoints/Indices/GetFieldMapping.lua @@ -45,9 +45,6 @@ function GetFieldMapping:getUri() if self.index ~= nil then uri = "/" .. self.index .. uri end - if self.type ~= nil then - uri = uri .. "/" .. self.type - end uri = uri .. "/field/" .. self.fields diff --git a/src/elasticsearch/endpoints/Indices/GetMapping.lua b/src/elasticsearch/endpoints/Indices/GetMapping.lua index 2cb84e5..c19e093 100644 --- a/src/elasticsearch/endpoints/Indices/GetMapping.lua +++ b/src/elasticsearch/endpoints/Indices/GetMapping.lua @@ -41,10 +41,7 @@ function GetMapping:getUri() if self.index ~= nil then uri = "/" .. self.index .. uri end - if self.type ~= nil then - uri = uri .. "/" .. self.type - end - + return uri end diff --git a/src/elasticsearch/endpoints/Indices/GetWarmer.lua b/src/elasticsearch/endpoints/Indices/GetWarmer.lua deleted file mode 100644 index f904389..0000000 --- a/src/elasticsearch/endpoints/Indices/GetWarmer.lua +++ /dev/null @@ -1,64 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local IndicesEndpoint = require "elasticsearch.endpoints.Indices.IndicesEndpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local GetWarmer = IndicesEndpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- The parameters that are allowed to be used in params -GetWarmer.allowedParams = { - ["ignore_unavailable"] = true, - ["allow_no_indices"] = true, - ["expand_wildcards"] = true, - ["local"] = true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function GetWarmer:getMethod() - return "GET" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function GetWarmer:getUri() - if self.index ~= nil and self.type ~= nil and self.name == nil then - return nil, "If index and type are specified, then name must also be specified for Get Warmer" - end - - local uri = "/_warmer" - if self.name ~= nil then - uri = uri .. "/" .. self.name - end - if self.type ~= nil and self.index ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then - uri = "/" .. self.index .. uri - end - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of GetWarmer class -------------------------------------------------------------------------------- -function GetWarmer:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return GetWarmer diff --git a/src/elasticsearch/endpoints/Indices/IndicesEndpoint.lua b/src/elasticsearch/endpoints/Indices/IndicesEndpoint.lua index 20e485a..8431577 100644 --- a/src/elasticsearch/endpoints/Indices/IndicesEndpoint.lua +++ b/src/elasticsearch/endpoints/Indices/IndicesEndpoint.lua @@ -32,7 +32,6 @@ function IndicesEndpoint:setParams(params) -- Clearing parameters self.name = nil self.index = nil - self.type = nil self.fields = nil self.isSynced = nil self.feature = nil @@ -44,8 +43,6 @@ function IndicesEndpoint:setParams(params) self.name = v elseif i == "index" then self.index = v - elseif i == "type" then - self.type = v elseif i == "fields" then self.fields = v elseif i == "sync" then diff --git a/src/elasticsearch/endpoints/Indices/PutMapping.lua b/src/elasticsearch/endpoints/Indices/PutMapping.lua index 819ac58..628a3cd 100644 --- a/src/elasticsearch/endpoints/Indices/PutMapping.lua +++ b/src/elasticsearch/endpoints/Indices/PutMapping.lua @@ -38,11 +38,7 @@ end -- @return string The URI ------------------------------------------------------------------------------- function PutMapping:getUri() - if self.type == nil then - return nil, "Type not specified for Put Mapping" - end - - local uri = "/_mapping/" .. self.type + local uri = "/_mapping" if self.index ~= nil then uri = "/" .. self.index .. uri diff --git a/src/elasticsearch/endpoints/Indices/PutWarmer.lua b/src/elasticsearch/endpoints/Indices/PutWarmer.lua deleted file mode 100644 index d0faca6..0000000 --- a/src/elasticsearch/endpoints/Indices/PutWarmer.lua +++ /dev/null @@ -1,62 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local IndicesEndpoint = require "elasticsearch.endpoints.Indices.IndicesEndpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local PutWarmer = IndicesEndpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- The parameters that are allowed to be used in params -PutWarmer.allowedParams = { - ["master_timeout"] = true, - ["ignore_unavailable"] = true, - ["allow_no_indices"] = true, - ["expand_wildcards"] = true, - ["request_cache"] = true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function PutWarmer:getMethod() - return "PUT" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function PutWarmer:getUri() - if self.name == nil then - return nil, "name not specified for Put Warmer" - end - - local uri = "/_warmer/" .. self.name - if self.index ~= nil and self.type ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then - uri = "/" .. self.index .. uri - end - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of PutWarmer class -------------------------------------------------------------------------------- -function PutWarmer:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return PutWarmer diff --git a/src/elasticsearch/endpoints/Indices/ValidateQuery.lua b/src/elasticsearch/endpoints/Indices/ValidateQuery.lua index 8204211..2a78a18 100644 --- a/src/elasticsearch/endpoints/Indices/ValidateQuery.lua +++ b/src/elasticsearch/endpoints/Indices/ValidateQuery.lua @@ -48,9 +48,6 @@ end function ValidateQuery:getUri() local uri = "/_validate/query" - if self.type ~= nil then - uri = "/" .. self.type .. uri - end if self.index ~= nil then uri = "/" .. self.index .. uri end diff --git a/src/elasticsearch/endpoints/MGet.lua b/src/elasticsearch/endpoints/MGet.lua index c637763..e7f1598 100644 --- a/src/elasticsearch/endpoints/MGet.lua +++ b/src/elasticsearch/endpoints/MGet.lua @@ -40,12 +40,8 @@ end ------------------------------------------------------------------------------- function MGet:getUri() local uri = "/_mget" - if self.index ~= nil and self.type ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then + if self.index ~= nil then uri = "/" .. self.index .. uri - elseif self.type ~= nil then - uri = "/_all/" .. self.type .. uri end return uri end diff --git a/src/elasticsearch/endpoints/MPercolate.lua b/src/elasticsearch/endpoints/MPercolate.lua deleted file mode 100644 index b81d4e4..0000000 --- a/src/elasticsearch/endpoints/MPercolate.lua +++ /dev/null @@ -1,61 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local Endpoint = require "elasticsearch.endpoints.Endpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local MPercolate = Endpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- bulk body is present for MPercolate -MPercolate.bulkBody = true - --- The parameters that are allowed to be used in params -MPercolate.allowedParams = { - ["ignore_unavailable"] = true, - ["allow_no_indices"] = true, - ["expand_wildcards"] = true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function MPercolate:getMethod() - return "POST" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function MPercolate:getUri() - local uri = "/_mpercolate" - if self.index ~= nil and self.type ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then - uri = "/" .. self.index .. uri - elseif self.type ~= nil then - uri = "/_all/" .. self.type .. uri - end - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of MPercolate class -------------------------------------------------------------------------------- -function MPercolate:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return MPercolate diff --git a/src/elasticsearch/endpoints/MSearch.lua b/src/elasticsearch/endpoints/MSearch.lua index 47955bc..889ee0b 100644 --- a/src/elasticsearch/endpoints/MSearch.lua +++ b/src/elasticsearch/endpoints/MSearch.lua @@ -36,12 +36,10 @@ end ------------------------------------------------------------------------------- function MSearch:getUri() local uri = "/_msearch" - if self.index ~= nil and self.type ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then + if self.index ~= nil then uri = "/" .. self.index .. uri - elseif self.type ~= nil then - uri = "/_all/" .. self.type .. uri + else + uri = "/_all" .. uri end return uri end diff --git a/src/elasticsearch/endpoints/MTermVectors.lua b/src/elasticsearch/endpoints/MTermVectors.lua index 2a6081e..4ec441e 100644 --- a/src/elasticsearch/endpoints/MTermVectors.lua +++ b/src/elasticsearch/endpoints/MTermVectors.lua @@ -45,12 +45,10 @@ end ------------------------------------------------------------------------------- function MTermVectors:getUri() local uri = "/_mtermvectors" - if self.index ~= nil and self.type ~= nil then - uri = "/" .. self.index .. "/" .. self.type .. uri - elseif self.index ~= nil then + if self.index ~= nil then uri = "/" .. self.index .. uri - elseif self.type ~= nil then - uri = "/_all/" .. self.type .. uri + else + uri = "/_all/" .. uri end return uri end diff --git a/src/elasticsearch/endpoints/Mlt.lua b/src/elasticsearch/endpoints/Mlt.lua index fc1252d..252f8e1 100644 --- a/src/elasticsearch/endpoints/Mlt.lua +++ b/src/elasticsearch/endpoints/Mlt.lua @@ -53,13 +53,10 @@ function Mlt:getUri() if self.index == nil then return nil, "index not specified for Mlt" end - if self.type == nil then - return nil, "type not specified for Mlt" - end if self.id == nil then return nil, "id not specified for Mlt" end - local uri = "/" .. self.index .. "/" .. self.type .. "/" .. self.id .. "/_mlt" + local uri = "/" .. self.index .. "/" .. self.id .. "/_mlt" return uri end diff --git a/src/elasticsearch/endpoints/Percolate.lua b/src/elasticsearch/endpoints/Percolate.lua deleted file mode 100644 index bd6b756..0000000 --- a/src/elasticsearch/endpoints/Percolate.lua +++ /dev/null @@ -1,70 +0,0 @@ -------------------------------------------------------------------------------- --- Importing modules -------------------------------------------------------------------------------- -local Endpoint = require "elasticsearch.endpoints.Endpoint" - -------------------------------------------------------------------------------- --- Declaring module -------------------------------------------------------------------------------- -local Percolate = Endpoint:new() - -------------------------------------------------------------------------------- --- Declaring Instance variables -------------------------------------------------------------------------------- - --- The parameters that are allowed to be used in params -Percolate.allowedParams = { - ["routing"] = true, - ["preference"] = true, - ["ignore_unavailable"] = true, - ["allow_no_indices"] = true, - ["expand_wildcards"] = true, - ["percolate_index"] = true, - ["percolate_type"] = true, - ["percolate_routing"] = true, - ["percolate_preference"] = true, - ["percolate_format"] = true, - ["version"] = true, - ["version_type"] = true -} - -------------------------------------------------------------------------------- --- Function to calculate the http request method --- --- @return string The HTTP request method -------------------------------------------------------------------------------- -function Percolate:getMethod() - return "GET" -end - -------------------------------------------------------------------------------- --- Function to calculate the URI --- --- @return string The URI -------------------------------------------------------------------------------- -function Percolate:getUri() - if self.index == nil then - return nil, "index not specified for Percolate" - end - if self.type == nil then - return nil, "type not specified for Percolate" - end - local uri = "/" .. self.index .. "/" .. self.type - if self.id ~= nil then - uri = uri .. "/" .. self.id - end - uri = uri .. "/_percolate" - return uri -end - -------------------------------------------------------------------------------- --- Returns an instance of Percolate class -------------------------------------------------------------------------------- -function Percolate:new(o) - o = o or {} - setmetatable(o, self) - self.__index = self - return o -end - -return Percolate diff --git a/src/elasticsearch/endpoints/Search.lua b/src/elasticsearch/endpoints/Search.lua index 9a8bef5..f7e8075 100644 --- a/src/elasticsearch/endpoints/Search.lua +++ b/src/elasticsearch/endpoints/Search.lua @@ -63,14 +63,11 @@ end -- @return string The URI ------------------------------------------------------------------------------- function Search:getUri() - if self.index ~= nil and self.type ~= nil then - return "/" .. self.index .. "/" .. self.type .. "/_search" - elseif self.index ~= nil and self.type == nil then + if self.index ~= nil then return "/" .. self.index .. "/_search" - elseif self.index == nil and self.type ~= nil then - return "/_all/" .. self.type .. "/_search" + elseif self.index == nil then + return "/_all/_search" end - -- Both are nil return "/_search" end diff --git a/src/elasticsearch/endpoints/SearchExists.lua b/src/elasticsearch/endpoints/SearchExists.lua index 6eb8e97..47b7d84 100644 --- a/src/elasticsearch/endpoints/SearchExists.lua +++ b/src/elasticsearch/endpoints/SearchExists.lua @@ -62,14 +62,11 @@ end -- @return string The URI ------------------------------------------------------------------------------- function SearchExists:getUri() - if self.index ~= nil and self.type ~= nil then - return "/" .. self.index .. "/" .. self.type .. "/_search/exists" - elseif self.index ~= nil and self.type == nil then + if self.index ~= nil then return "/" .. self.index .. "/_search/exists" - elseif self.index == nil and self.type ~= nil then - return "/_all/" .. self.type .. "/_search/exists" + elseif self.index == nil then + return "/_all/_search/exists" end - -- Both are nil return "/_search/exists" end diff --git a/src/elasticsearch/endpoints/SearchShards.lua b/src/elasticsearch/endpoints/SearchShards.lua index cc4e047..ab4bba3 100644 --- a/src/elasticsearch/endpoints/SearchShards.lua +++ b/src/elasticsearch/endpoints/SearchShards.lua @@ -37,14 +37,11 @@ end -- @return string The URI ------------------------------------------------------------------------------- function SearchShards:getUri() - if self.index ~= nil and self.type ~= nil then - return "/" .. self.index .. "/" .. self.type .. "/_search_shards" - elseif self.index ~= nil and self.type == nil then + if self.index ~= nil then return "/" .. self.index .. "/_search_shards" - elseif self.index == nil and self.type ~= nil then - return "/_all/" .. self.type .. "/_search_shards" + elseif self.index == nil then + return "/_all/_search_shards" end - -- Both are nil return "/_search_shards" end diff --git a/src/elasticsearch/endpoints/SearchTemplate.lua b/src/elasticsearch/endpoints/SearchTemplate.lua index e9b6e9b..895f528 100644 --- a/src/elasticsearch/endpoints/SearchTemplate.lua +++ b/src/elasticsearch/endpoints/SearchTemplate.lua @@ -38,14 +38,9 @@ end -- @return string The URI ------------------------------------------------------------------------------- function SearchTemplate:getUri() - if self.index ~= nil and self.type ~= nil then - return "/" .. self.index .. "/" .. self.type .. "/_search/template" - elseif self.index ~= nil and self.type == nil then + if self.index ~= nil then return "/" .. self.index .. "/_search/template" - elseif self.index == nil and self.type ~= nil then - return "/_all/" .. self.type .. "/_search/template" end - -- Both are nil return "/_search/template" end diff --git a/src/elasticsearch/endpoints/TermVectors.lua b/src/elasticsearch/endpoints/TermVectors.lua index 6c0637c..a5e584f 100644 --- a/src/elasticsearch/endpoints/TermVectors.lua +++ b/src/elasticsearch/endpoints/TermVectors.lua @@ -47,10 +47,7 @@ function TermVectors:getUri() if self.index == nil then return nil, "index not specified for TermVectors" end - if self.type == nil then - return nil, "type not specified for TermVectors" - end - local uri = "/" .. self.index .. "/" .. self.type .. "/" .. self.id + local uri = "/" .. self.index .. "/" .. self.id .. "/_termvectors" return uri end diff --git a/src/elasticsearch/endpoints/Update.lua b/src/elasticsearch/endpoints/Update.lua index 115cc47..1db2ec2 100644 --- a/src/elasticsearch/endpoints/Update.lua +++ b/src/elasticsearch/endpoints/Update.lua @@ -52,13 +52,6 @@ function Update:getUri() return nil, "index not specified for Update" end - -- fix es since 7+ don't support type. - -- removes if - - --[[if self.type == nil then - return nil, "type not specified for Update" - end]] - -- update uri -- es : https://www.elastic.co/guide/en/elasticsearch/reference/7.0/docs-update.html#docs-update return "/" .. self.index .. "/_update/" .. self.id diff --git a/src/elasticsearch/endpoints/UpdateByQuery.lua b/src/elasticsearch/endpoints/UpdateByQuery.lua index 07a402d..33165d8 100644 --- a/src/elasticsearch/endpoints/UpdateByQuery.lua +++ b/src/elasticsearch/endpoints/UpdateByQuery.lua @@ -74,10 +74,7 @@ function UpdateByQuery:getUri() if self.index == nil then return nil, "index not specified for UpdateByQuery" end - if self.type ~= nil then - uri = "/" .. self.type .. uri - end - uri = "/" .. self.index .. uri + uri = "/" .. self.index .. uri return uri end diff --git a/tests/endpoints/CountPercolateTest.lua b/tests/endpoints/CountPercolateTest.lua deleted file mode 100644 index cd9ebde..0000000 --- a/tests/endpoints/CountPercolateTest.lua +++ /dev/null @@ -1,62 +0,0 @@ --- Importing modules -local CountPercolate = require "elasticsearch.endpoints.CountPercolate" -local parser = require "elasticsearch.parser" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.CountPercolateTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(CountPercolate.new) - local o = CountPercolate:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = CountPercolate:new{ - transport = mockTransport - } -end - --- Testing without id -function requestTest() - mockTransport.method = "GET" - mockTransport.uri = "/my-index/my-type/_percolate/count" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "my-index", - type = "my-type" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing with id -function requestIdTest() - mockTransport.method = "GET" - mockTransport.uri = "/my-index/my-type/my-id/_percolate/count" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "my-index", - type = "my-type", - id = "my-id" - } - - local _, err = endpoint:request() - assert_nil(err) -end diff --git a/tests/endpoints/CountTest.lua b/tests/endpoints/CountTest.lua index b581cf0..dd6410d 100644 --- a/tests/endpoints/CountTest.lua +++ b/tests/endpoints/CountTest.lua @@ -31,7 +31,7 @@ end -- Testing request function request1Test() mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/_count" + mockTransport.uri = "/twitter/_count" mockTransport.params = { q = "user:kimchy" } @@ -39,7 +39,6 @@ function request1Test() endpoint:setParams{ index = "twitter", - type = "tweet", q = "user:kimchy" } local _, err = endpoint:request() @@ -49,7 +48,7 @@ end -- Testing request function request2Test() mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/_count" + mockTransport.uri = "/twitter/_count" mockTransport.params = {} mockTransport.body = parser.jsonEncode{ query = { @@ -61,7 +60,6 @@ function request2Test() endpoint:setParams{ index = "twitter", - type = "tweet", body = { query = { term = { diff --git a/tests/endpoints/DeleteByQueryTest.lua b/tests/endpoints/DeleteByQueryTest.lua index eebaac1..41e4578 100644 --- a/tests/endpoints/DeleteByQueryTest.lua +++ b/tests/endpoints/DeleteByQueryTest.lua @@ -46,13 +46,12 @@ end -- Testing with type function requestTypeTest() mockTransport.method = "DELETE" - mockTransport.uri = "/twitter/tweet/_query" + mockTransport.uri = "/twitter/_query" mockTransport.params = {} mockTransport.body = nil endpoint:setParams{ - index = "twitter", - type = "tweet" + index = "twitter" } local _, err = endpoint:request() diff --git a/tests/endpoints/EndpointTest.lua b/tests/endpoints/EndpointTest.lua index 9f9bf73..0b8d759 100644 --- a/tests/endpoints/EndpointTest.lua +++ b/tests/endpoints/EndpointTest.lua @@ -67,7 +67,6 @@ end function setStandardParamsTest() local testParams = { index = "my_index", - type = "my_type", id = "my_id", body = { a = "b" @@ -78,7 +77,6 @@ function setStandardParamsTest() local err = e:setParams(testParams) assert_nil(err) assert_equal("my_index", e.index) - assert_equal("my_type", e.type) assert_equal("my_id", e.id) assert_equal(actualBody, e.body) end diff --git a/tests/endpoints/ExplainTest.lua b/tests/endpoints/ExplainTest.lua index 9661dd2..8853a02 100644 --- a/tests/endpoints/ExplainTest.lua +++ b/tests/endpoints/ExplainTest.lua @@ -31,7 +31,7 @@ end -- Testing request function request1Test() mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/1/_explain" + mockTransport.uri = "/twitter/1/_explain" mockTransport.params = {} mockTransport.body = parser.jsonEncode{ query = { @@ -43,7 +43,6 @@ function request1Test() endpoint:setParams{ index = "twitter", - type = "tweet", id = "1", body = { query = { @@ -61,7 +60,7 @@ end -- Testing request function request2test() mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/1/_explain" + mockTransport.uri = "/twitter/1/_explain" mockTransport.params = { q = "message:search" } @@ -69,7 +68,6 @@ function request2test() endpoint:setParams{ index = "twitter", - type = "tweet", id = "1", q = "message:search" } diff --git a/tests/endpoints/IndexTest.lua b/tests/endpoints/IndexTest.lua index 15690ee..fa42c4b 100644 --- a/tests/endpoints/IndexTest.lua +++ b/tests/endpoints/IndexTest.lua @@ -67,7 +67,6 @@ function requestPOSTTest() endpoint:setParams{ index = "twitter", - type = "tweet", body = { user = "kimchy", post_date = "2009-11-15T14:12:12", diff --git a/tests/endpoints/IndicesTest/DeleteMappingTest.lua b/tests/endpoints/IndicesTest/DeleteMappingTest.lua index f506d1e..955f153 100644 --- a/tests/endpoints/IndicesTest/DeleteMappingTest.lua +++ b/tests/endpoints/IndicesTest/DeleteMappingTest.lua @@ -30,13 +30,12 @@ end -- Testing request function requestTest() mockTransport.method = "DELETE" - mockTransport.uri = "/twitter/tweet/_mapping" + mockTransport.uri = "/twitter/_mapping" mockTransport.params = {} mockTransport.body = nil endpoint:setParams{ - index = "twitter", - type = "tweet" + index = "twitter" } local _, err = endpoint:request() diff --git a/tests/endpoints/IndicesTest/DeleteWarmerTest.lua b/tests/endpoints/IndicesTest/DeleteWarmerTest.lua deleted file mode 100644 index a690edd..0000000 --- a/tests/endpoints/IndicesTest/DeleteWarmerTest.lua +++ /dev/null @@ -1,65 +0,0 @@ --- Importing modules -local DeleteWarmer = require "elasticsearch.endpoints.Indices.DeleteWarmer" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.IndicesTest.DeleteWarmerTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(DeleteWarmer.new) - local o = DeleteWarmer:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = DeleteWarmer:new{ - transport = mockTransport - } -end - --- Testing request -function requestTest() - mockTransport.method = "DELETE" - mockTransport.uri = "/users/_warmer/user_12" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "users", - name = "user_12" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing error request -function requestErrorTest() - mockTransport.method = "DELETE" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "test" - } - - local _, err = endpoint:request() - assert_not_nil(err) - - endpoint:setParams{ - name = "name" - } - - local _, err = endpoint:request() - assert_not_nil(err) -end diff --git a/tests/endpoints/IndicesTest/ExistsTypeTest.lua b/tests/endpoints/IndicesTest/ExistsTypeTest.lua deleted file mode 100644 index 6120a97..0000000 --- a/tests/endpoints/IndicesTest/ExistsTypeTest.lua +++ /dev/null @@ -1,66 +0,0 @@ --- Importing modules -local ExistsType = require "elasticsearch.endpoints.Indices.ExistsType" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.IndicesTest.ExistsTypeTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(ExistsType.new) - local o = ExistsType:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = ExistsType:new{ - transport = mockTransport - } -end - --- Testing request -function requestTest() - mockTransport.method = "HEAD" - mockTransport.uri = "/twitter/tweet" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing error request -function requestErrorTest() - mockTransport.method = "HEAD" - mockTransport.uri = "/twitter/tweet" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - } - - local _, err = endpoint:request() - assert_not_nil(err) - - endpoint:setParams{ - type = "tweet", - } - - local _, err = endpoint:request() - assert_not_nil(err) -end diff --git a/tests/endpoints/IndicesTest/GetFieldMappingTest.lua b/tests/endpoints/IndicesTest/GetFieldMappingTest.lua index 37f2bec..de935aa 100644 --- a/tests/endpoints/IndicesTest/GetFieldMappingTest.lua +++ b/tests/endpoints/IndicesTest/GetFieldMappingTest.lua @@ -58,39 +58,6 @@ function requestIndexTest() assert_nil(err) end --- Testing name request -function requestTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/_mapping/tweet/field/text" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - type = "tweet", - fields = "text" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index and name request -function requestIndexTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/twitter/_mapping/tweet/field/text" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet", - fields = "text" - } - - local _, err = endpoint:request() - assert_nil(err) -end - -- Testing error function requestErrorTest() mockTransport.method = "GET" diff --git a/tests/endpoints/IndicesTest/GetMappingTest.lua b/tests/endpoints/IndicesTest/GetMappingTest.lua index 2b5dd73..895a6e2 100644 --- a/tests/endpoints/IndicesTest/GetMappingTest.lua +++ b/tests/endpoints/IndicesTest/GetMappingTest.lua @@ -53,35 +53,4 @@ function requestIndexTest() local _, err = endpoint:request() assert_nil(err) -end - --- Testing name request -function requestTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/_mapping/user_12" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - type = "user_12" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index and name request -function requestIndexTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/users/_mapping/user_12" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "users", - type = "user_12" - } - - local _, err = endpoint:request() - assert_nil(err) -end +end \ No newline at end of file diff --git a/tests/endpoints/IndicesTest/GetWarmerTest.lua b/tests/endpoints/IndicesTest/GetWarmerTest.lua deleted file mode 100644 index ed44d73..0000000 --- a/tests/endpoints/IndicesTest/GetWarmerTest.lua +++ /dev/null @@ -1,116 +0,0 @@ --- Importing modules -local GetWarmer = require "elasticsearch.endpoints.Indices.GetWarmer" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.IndicesTest.GetWarmerTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(GetWarmer.new) - local o = GetWarmer:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = GetWarmer:new{ - transport = mockTransport - } -end - --- Testing request -function requestTest() - mockTransport.method = "GET" - mockTransport.uri = "/_warmer" - mockTransport.params = {} - mockTransport.body = nil - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing name request -function requestNameTest() - mockTransport.method = "GET" - mockTransport.uri = "/_warmer/user_21" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - name = "user_21" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index request -function requestIndexTest() - mockTransport.method = "GET" - mockTransport.uri = "/twitter/_warmer" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing type request -function requestTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/_warmer" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - type = "tweet" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index, type and name request -function requestIndexTypeNameTest() - mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/_warmer/user_21" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet", - name = "user_21" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing error request -function requestErrorTest() - mockTransport.method = "GET" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet" - } - - local _, err = endpoint:request() - assert_not_nil(err) -end diff --git a/tests/endpoints/IndicesTest/PutMappingTest.lua b/tests/endpoints/IndicesTest/PutMappingTest.lua index c6c108d..335bcf4 100644 --- a/tests/endpoints/IndicesTest/PutMappingTest.lua +++ b/tests/endpoints/IndicesTest/PutMappingTest.lua @@ -2,6 +2,7 @@ local PutMapping = require "elasticsearch.endpoints.Indices.PutMapping" local MockTransport = require "lib.MockTransport" local getmetatable = getmetatable +local parser = require "elasticsearch.parser" -- Setting up environment local _ENV = lunit.TEST_CASE "tests.endpoints.IndicesTest.PutMappingTest" @@ -32,12 +33,13 @@ function requestTest() mockTransport.method = "PUT" mockTransport.uri = "/_mapping" mockTransport.params = {} - mockTransport.body = nil + mockTransport.body = nill - endpoint:setParams{} + endpoint:setParams{ + } local _, err = endpoint:request() - assert_not_nil(err) + assert_nil(err) end -- Testing index request @@ -51,37 +53,7 @@ function requestIndexTest() index = "users" } - local _, err = endpoint:request() - assert_not_nil(err) -end - --- Testing name request -function requestTypeTest() - mockTransport.method = "PUT" - mockTransport.uri = "/_mapping/user_12" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - type = "user_12" - } - local _, err = endpoint:request() assert_nil(err) end --- Testing index and name request -function requestIndexTypeTest() - mockTransport.method = "PUT" - mockTransport.uri = "/users/_mapping/user_12" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "users", - type = "user_12" - } - - local _, err = endpoint:request() - assert_nil(err) -end diff --git a/tests/endpoints/IndicesTest/PutWarmerTest.lua b/tests/endpoints/IndicesTest/PutWarmerTest.lua deleted file mode 100644 index 255a59e..0000000 --- a/tests/endpoints/IndicesTest/PutWarmerTest.lua +++ /dev/null @@ -1,107 +0,0 @@ --- Importing modules -local PutWarmer = require "elasticsearch.endpoints.Indices.PutWarmer" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.IndicesTest.PutWarmerTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(PutWarmer.new) - local o = PutWarmer:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = PutWarmer:new{ - transport = mockTransport - } -end - --- Testing name request -function requestNameTest() - mockTransport.method = "PUT" - mockTransport.uri = "/_warmer/user_21" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - name = "user_21" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index name request -function requestIndexNameTest() - mockTransport.method = "PUT" - mockTransport.uri = "/twitter/_warmer/user_21" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - name = "user_21" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing type name request -function requestTypeNameTest() - mockTransport.method = "PUT" - mockTransport.uri = "/_warmer/user_21" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - type = "tweet", - name = "user_21" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index, type and name request -function requestIndexTypeNameTest() - mockTransport.method = "PUT" - mockTransport.uri = "/twitter/tweet/_warmer/user_21" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet", - name = "user_21" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing error request -function requestErrorTest() - mockTransport.method = "PUT" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet" - } - - local _, err = endpoint:request() - assert_not_nil(err) -end diff --git a/tests/endpoints/IndicesTest/ValidateQueryTest.lua b/tests/endpoints/IndicesTest/ValidateQueryTest.lua index 50a2084..2b6c3b1 100644 --- a/tests/endpoints/IndicesTest/ValidateQueryTest.lua +++ b/tests/endpoints/IndicesTest/ValidateQueryTest.lua @@ -54,34 +54,3 @@ function requestIndexTest() local _, err = endpoint:request() assert_nil(err) end - --- Testing type request -function requestTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/tweet/_validate/query" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - type = "tweet" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing index and type request -function requestIndexTypeTest() - mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/_validate/query" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet" - } - - local _, err = endpoint:request() - assert_nil(err) -end diff --git a/tests/endpoints/IndicesTest/init.lua b/tests/endpoints/IndicesTest/init.lua index d3299ce..68ee2fb 100644 --- a/tests/endpoints/IndicesTest/init.lua +++ b/tests/endpoints/IndicesTest/init.lua @@ -16,13 +16,9 @@ require "endpoints.IndicesTest.DeleteTemplateTest" require "endpoints.IndicesTest.ExistsTemplateTest" require "endpoints.IndicesTest.GetTemplateTest" require "endpoints.IndicesTest.PutTemplateTest" -require "endpoints.IndicesTest.ExistsTypeTest" require "endpoints.IndicesTest.GetUpgradeTest" require "endpoints.IndicesTest.PostUpgradeTest" require "endpoints.IndicesTest.ValidateQueryTest" -require "endpoints.IndicesTest.DeleteWarmerTest" -require "endpoints.IndicesTest.GetWarmerTest" -require "endpoints.IndicesTest.PutWarmerTest" require "endpoints.IndicesTest.AnalyzeTest" require "endpoints.IndicesTest.CloseTest" require "endpoints.IndicesTest.CreateTest" diff --git a/tests/endpoints/MGetTest.lua b/tests/endpoints/MGetTest.lua index 56ad4d7..8ceb0be 100644 --- a/tests/endpoints/MGetTest.lua +++ b/tests/endpoints/MGetTest.lua @@ -31,7 +31,7 @@ end -- Testing request function requestTest() mockTransport.method = "POST" - mockTransport.uri = "/test/type/_mget" + mockTransport.uri = "/test/_mget" mockTransport.params = {} mockTransport.body = parser.jsonEncode{ ids = {"1", "2"} @@ -39,7 +39,6 @@ function requestTest() endpoint:setParams{ index = "test", - type = "type", body = { ids = {"1", "2"} } diff --git a/tests/endpoints/MPercolateTest.lua b/tests/endpoints/MPercolateTest.lua deleted file mode 100644 index 32f636d..0000000 --- a/tests/endpoints/MPercolateTest.lua +++ /dev/null @@ -1,63 +0,0 @@ --- Importing modules -local MPercolate = require "elasticsearch.endpoints.MPercolate" -local parser = require "elasticsearch.parser" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.MPercolateTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(MPercolate.new) - local o = MPercolate:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = MPercolate:new{ - transport = mockTransport - } -end - --- Testing request -function requestTest() - mockTransport.method = "POST" - mockTransport.uri = "/twitter/tweet/_mpercolate" - mockTransport.params = {} - - local MPercolateBody = { - { - percolate = { - index = "twitter", - type = "tweet" - } - }, - { - doc = { - message = "some text" - } - } - } - - mockTransport.body = "" - for _id, item in pairs(MPercolateBody) do - mockTransport.body = mockTransport.body .. parser.jsonEncode(item) .. "\n" - end - - endpoint:setParams{ - index = "twitter", - type = "tweet", - body = MPercolateBody - } - local _, err = endpoint:request() - assert_nil(err) -end diff --git a/tests/endpoints/MSearchTest.lua b/tests/endpoints/MSearchTest.lua index 5cf6e9e..10b8a0f 100644 --- a/tests/endpoints/MSearchTest.lua +++ b/tests/endpoints/MSearchTest.lua @@ -64,7 +64,7 @@ end -- Testing 'all' request function requestAllTest() mockTransport.method = "GET" - mockTransport.uri = "/_all/test/_msearch" + mockTransport.uri = "/_all/_msearch" mockTransport.params = {} local testBody = { @@ -86,7 +86,6 @@ function requestAllTest() .. parser.jsonEncode(testBody[2]) .. "\n" endpoint:setParams{ - type = "test", body = testBody } diff --git a/tests/endpoints/MTermVectorsTest.lua b/tests/endpoints/MTermVectorsTest.lua index e6c4213..9f1a954 100644 --- a/tests/endpoints/MTermVectorsTest.lua +++ b/tests/endpoints/MTermVectorsTest.lua @@ -31,7 +31,7 @@ end -- Testing request function requestTest() mockTransport.method = "POST" - mockTransport.uri = "/test/type/_mtermvectors" + mockTransport.uri = "/test/_mtermvectors" mockTransport.params = {} mockTransport.body = parser.jsonEncode{ ids = {"1", "2"} @@ -39,7 +39,6 @@ function requestTest() endpoint:setParams{ index = "test", - type = "type", body = { ids = {"1", "2"} } diff --git a/tests/endpoints/MltTest.lua b/tests/endpoints/MltTest.lua index 60223a7..29b299e 100644 --- a/tests/endpoints/MltTest.lua +++ b/tests/endpoints/MltTest.lua @@ -30,13 +30,12 @@ end -- Testing request function requestTest() mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/1/_mlt" + mockTransport.uri = "/twitter/1/_mlt" mockTransport.params = {} mockTransport.body = nil endpoint:setParams{ index = "twitter", - type = "tweet", id = "1" } diff --git a/tests/endpoints/PercolateTest.lua b/tests/endpoints/PercolateTest.lua deleted file mode 100644 index e0b3c1e..0000000 --- a/tests/endpoints/PercolateTest.lua +++ /dev/null @@ -1,61 +0,0 @@ --- Importing modules -local Percolate = require "elasticsearch.endpoints.Percolate" -local MockTransport = require "lib.MockTransport" -local getmetatable = getmetatable - --- Setting up environment -local _ENV = lunit.TEST_CASE "tests.endpoints.PercolateTest" - --- Declaring local variables -local endpoint -local mockTransport = MockTransport:new() - --- Testing the constructor -function constructorTest() - assert_function(Percolate.new) - local o = Percolate:new() - assert_not_nil(o) - local mt = getmetatable(o) - assert_table(mt) - assert_equal(mt, mt.__index) -end - --- The setup function -function setup() - endpoint = Percolate:new{ - transport = mockTransport - } -end - --- Testing request -function requestTest() - mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/_percolate" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet" - } - - local _, err = endpoint:request() - assert_nil(err) -end - --- Testing request with id -function requestIdTest() - mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/1/_percolate" - mockTransport.params = {} - mockTransport.body = nil - - endpoint:setParams{ - index = "twitter", - type = "tweet", - id = "1" - } - - local _, err = endpoint:request() - assert_nil(err) -end diff --git a/tests/endpoints/SearchExistsTest.lua b/tests/endpoints/SearchExistsTest.lua index 838e971..63f5770 100644 --- a/tests/endpoints/SearchExistsTest.lua +++ b/tests/endpoints/SearchExistsTest.lua @@ -30,7 +30,7 @@ end -- Testing request function requestTest() mockTransport.method = "GET" - mockTransport.uri = "/twitter/tweet/_search/exists" + mockTransport.uri = "/twitter/_search/exists" mockTransport.params = { q = "user:kimchy" } @@ -38,7 +38,6 @@ function requestTest() endpoint:setParams{ index = "twitter", - type = "tweet", q = "user:kimchy" } diff --git a/tests/endpoints/SearchTest.lua b/tests/endpoints/SearchTest.lua index c1b4ebc..b826e01 100644 --- a/tests/endpoints/SearchTest.lua +++ b/tests/endpoints/SearchTest.lua @@ -48,14 +48,13 @@ end -- Testing all request function requestTest() mockTransport.method = "GET" - mockTransport.uri = "/_all/tweet/_search" + mockTransport.uri = "/_all/_search" mockTransport.params = { q = "user:kimchy" } mockTransport.body = nil endpoint:setParams{ - type = "tweet", q = "user:kimchy" } diff --git a/tests/endpoints/TermVectorsTest.lua b/tests/endpoints/TermVectorsTest.lua index 0ff3f20..2c86f60 100644 --- a/tests/endpoints/TermVectorsTest.lua +++ b/tests/endpoints/TermVectorsTest.lua @@ -31,13 +31,12 @@ end -- Testing request function requestTest() mockTransport.method = "POST" - mockTransport.uri = "/twitter/tweet/1/_termvectors" + mockTransport.uri = "/twitter/1/_termvectors" mockTransport.params = {} mockTransport.body = nil endpoint:setParams{ index = "twitter", - type = "tweet", id = "1" } diff --git a/tests/endpoints/UpdateByQueryTest.lua b/tests/endpoints/UpdateByQueryTest.lua index 1ddd9b7..d1f53a6 100644 --- a/tests/endpoints/UpdateByQueryTest.lua +++ b/tests/endpoints/UpdateByQueryTest.lua @@ -46,13 +46,12 @@ end -- Testing type request function requestTypeTest() mockTransport.method = "POST" - mockTransport.uri = "/twitter/tweet/_update_by_query" + mockTransport.uri = "/twitter/_update_by_query" mockTransport.params = {} mockTransport.body = nil endpoint:setParams{ index = "twitter", - type = "tweet" } local _, err = endpoint:request() diff --git a/tests/endpoints/UpdateTest.lua b/tests/endpoints/UpdateTest.lua index 559c959..9986a5c 100644 --- a/tests/endpoints/UpdateTest.lua +++ b/tests/endpoints/UpdateTest.lua @@ -31,7 +31,7 @@ end -- Testing request function requestTest() mockTransport.method = "POST" - mockTransport.uri = "/test/type1/1/_update" + mockTransport.uri = "/test/_update/1" mockTransport.params = {} mockTransport.body = parser.jsonEncode{ script = { @@ -44,7 +44,6 @@ function requestTest() endpoint:setParams{ index = "test", - type = "type1", id = "1", body = { script = { diff --git a/tests/endpoints/init.lua b/tests/endpoints/init.lua index f1d6011..45ada14 100644 --- a/tests/endpoints/init.lua +++ b/tests/endpoints/init.lua @@ -3,7 +3,6 @@ require "endpoints.EndpointTest" require "endpoints.BulkTest" require "endpoints.CountTest" -require "endpoints.CountPercolateTest" require "endpoints.DeleteTest" require "endpoints.DeleteByQueryTest" require "endpoints.DeleteTemplateTest" @@ -14,11 +13,9 @@ require "endpoints.GetTest" require "endpoints.IndexTest" require "endpoints.InfoTest" require "endpoints.MGetTest" -require "endpoints.MPercolateTest" require "endpoints.MSearchTest" require "endpoints.MTermVectorsTest" require "endpoints.MltTest" -require "endpoints.PercolateTest" require "endpoints.PingTest" require "endpoints.PutTemplateTest" require "endpoints.ReIndexTest" diff --git a/tests/gh_actions/setup_lua.sh b/tests/gh_actions/setup_lua.sh index a1cdb97..e04b960 100644 --- a/tests/gh_actions/setup_lua.sh +++ b/tests/gh_actions/setup_lua.sh @@ -8,64 +8,52 @@ set -eufo pipefail -LUAJIT_BASE="LuaJIT-2.0.5" - source $GITHUB_WORKSPACE/tests/gh_actions/platform.sh LUA_HOME_DIR=$GITHUB_WORKSPACE/install/lua LR_HOME_DIR=$GITHUB_WORKSPACE/install/luarocks -mkdir $HOME/.lua +rm -rf $HOME/.lua +mkdir -p $HOME/.lua -LUAJIT="no" +if [ "$LUA" == "luajit" ]; then + LUAJIT="yes" +else + LUAJIT="no" +fi if [ "$PLATFORM" == "macosx" ]; then - if [ "$LUA" == "luajit2.0" ]; then - LUAJIT="yes"; - fi - if [ "$LUA" == "luajit2.1" ]; then - LUAJIT="yes"; - fi; -elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then - LUAJIT="yes"; + export MACOSX_DEPLOYMENT_TARGET=`sw_vers --productVersion` fi mkdir -p "$LUA_HOME_DIR" if [ "$LUAJIT" == "yes" ]; then - git clone https://github.com/luajit/luajit.git -b v2.0 $LUAJIT_BASE; + git clone https://luajit.org/git/luajit.git; - cd $LUAJIT_BASE - - if [ "$LUA" == "luajit2.1" ]; then - git checkout v2.1; - # force the INSTALL_TNAME to be luajit - perl -i -pe 's/INSTALL_TNAME=.+/INSTALL_TNAME= luajit/' Makefile - fi + cd luajit make && make install PREFIX="$LUA_HOME_DIR" - if [ "$LUA" == "luajit2.1" ]; then - ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-beta1 $HOME/.lua/luajit - ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-beta1 $HOME/.lua/lua; - else - ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit - ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua; - fi; + ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit + ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua; else if [ "$LUA" == "lua5.1" ]; then - curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz + curl https://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz cd lua-5.1.5; elif [ "$LUA" == "lua5.2" ]; then - curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz + curl https://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz cd lua-5.2.4; elif [ "$LUA" == "lua5.3" ]; then - curl http://www.lua.org/ftp/lua-5.3.3.tar.gz | tar xz + curl https://www.lua.org/ftp/lua-5.3.3.tar.gz | tar xz cd lua-5.3.3; + elif [ "$LUA" == "lua5.4" ]; then + curl https://www.lua.org/ftp/lua-5.4.7.tar.gz | tar xz + cd lua-5.4.7; fi # Build Lua without backwards compatibility for testing @@ -88,10 +76,8 @@ curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz cd $LUAROCKS_BASE -if [ "$LUA" == "luajit2.0" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; -elif [ "$LUA" == "luajit2.1" ]; then - ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR"; +if [ "$LUA" == "luajit" ]; then + ./configure --lua-version="5.1" --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR"; else ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR" fi @@ -104,14 +90,14 @@ cd $GITHUB_WORKSPACE luarocks --version -rm -rf $LUAROCKS_BASE - if [ "$LUAJIT" == "yes" ]; then - rm -rf $LUAJIT_BASE; + rm -rf luajit; elif [ "$LUA" == "lua5.1" ]; then rm -rf lua-5.1.5; elif [ "$LUA" == "lua5.2" ]; then rm -rf lua-5.2.4; elif [ "$LUA" == "lua5.3" ]; then rm -rf lua-5.3.3; +elif [ "$LUA" == "lua5.4" ]; then + rm -rf lua-5.4.7; fi