Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed Performing Insert Without Id ( Generated Hash Id ) #6

Closed
chocopowwwa opened this issue Feb 27, 2017 · 3 comments
Closed

Failed Performing Insert Without Id ( Generated Hash Id ) #6

chocopowwwa opened this issue Feb 27, 2017 · 3 comments

Comments

@chocopowwwa
Copy link

chocopowwwa commented Feb 27, 2017

Code

  $sample = json_decode(file_get_contents($app->basePath().'/tests/json/mydata.json')); # Sample of my json doccument
  $app['es']->index('sample')->type('sample')->insert($sample);

Trace

  [2017-02-27 10:42:05] lumen.ERROR: Elasticsearch\Common\Exceptions\UnexpectedValueException: "id" is not a valid parameter. Allowed parameters are "client", "consistency", "custom", "filter_path", "human", "op_type", "parent", "percolate", "pipeline", "refresh", "replication", "routing", "timeout", "timestamp", "ttl", "version", "version_type" in /home/project/myapp/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php:221
  Stack trace:
  #0 /home/project/myapp/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(74): Elasticsearch\Endpoints\AbstractEndpoint->checkUserParams(Array)
  #1 /home/project/myapp/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(751): Elasticsearch\Endpoints\AbstractEndpoint->setParams(Array)
  #2 /home/project/myapp/vendor/basemkhirat/elasticsearch/src/Query.php(1005): Elasticsearch\Client->index(Array)
  #3 /home/project/myapp/routes/web.php(25): Basemkhirat\Elasticsearch\Query->insert(Object(stdClass))
  #4 [internal function]: Closure->{closure}()
...

Composer.lock

  "name": "basemkhirat/elasticsearch",
            "version": "0.9.1",
            "source": {
                "type": "git",
                "url": "https://github.com/basemkhirat/elasticsearch.git",
                "reference": "b8baccf8341c3719a11935a9c84388f697cb2819"
            },
  ..............
  "name": "elasticsearch/elasticsearch",
            "version": "v5.1.3",
            "source": {
                "type": "git",
                "url": "https://github.com/elastic/elasticsearch-php.git",
                "reference": "ee931ebb6f371dc31eecbd9ec2ab2cc563823453"
            },
  ..............
    "name": "laravel/lumen-framework",
            "version": "v5.4.4",
            "source": {
                "type": "git",
                "url": "https://github.com/laravel/lumen-framework.git",
                "reference": "e88e7ac6fa22bdedb0fc0f55e6abed0d8a6c4ca2"
            },

My Workaround
src/Query.php:1004

       if (is_null($parameters['id'])) {
            unset($parameters['id']);
        }
@basemkhirat
Copy link
Owner

basemkhirat commented Feb 27, 2017

Thanks @chocopowwwa
This issue will be fixed today with a new package version.

@basemkhirat
Copy link
Owner

basemkhirat commented Feb 27, 2017

Hello @chocopowwwa,

Try now to update your package to version 0.9.3 and will work.

@chocopowwwa
Copy link
Author

Issue Solved,

UZPENG pushed a commit to UZPENG/elasticsearch that referenced this issue Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants