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
vectorstores error: "search_phase_execution_exceptionm" after using elastic search #2386
Comments
Can you confirm that the index has that name? Have you checked Kibana for information on it? I believe that fixing it can be easy, and the test should also be improved. In my opinion, this occurred because the GitHub workflow only ran unit tests and not any functional tests at the moment. elastic_search.from_documents(
documents=get_documents(),
embedding=embedding,
index_name="my_cool_name", # the index name did not work as expected, so a new random name was created.
) |
This is the way I called the save, so, I made sure the index_name was the same and checked it on kibana
|
Please remove all indexes from ElasticSearch and then run your script to recreate the index with the newly created documents. Once the process is completed, kindly confirm that the index has been created with the required name. Additionally, I request that you provide a screenshot from Kibana, if possible, that shows all of your indexes. P.S. Right now, I am working on improving some tests with |
@sergerdn all of my indexes |
Determine the problem, when using from_documents to build, and then use ElasticVectorSearch to build the object is normally accessible. But if we directly use ElasticVectorSearch to build the object and then add the content by way of add_documents, we will get an error when similarity_search |
The difference is in this line of code
|
To ensure we fully understand the problem, could you please provide code snippets that reproduce the issue? From the description provided, it seems like a familiar bug to me. Additionally, please share a code snippet that demonstrates that everything is functioning as expected. This will help confirm that you are only seeing the expected index and not an arbitrary one. |
|
Okay, it seems that it is a bug that I have described above, which can be found at #2386 (comment). I am having difficulty updating the tests properly, as it will be more challenging for me than fixing the bug. Please be patient, I will work on fixing it. |
tks |
- Create a new docker-compose file to start an Elasticsearch instance for integration tests. - Add new tests to `test_elasticsearch.py` to verify Elasticsearch functionality. - Include an optional group `test_integration` in the `pyproject.toml` file. This group should contain dependencies for integration tests and can be installed using the command `poetry install --with test_integration`. Any new dependencies should be added by running `poetry add some_new_deps --group "test_integration" ` Note: New tests running in live mode, which involve end-to-end testing of the OpenAI API. In the future, adding `pytest-vcr` to record and replay all API requests would be a nice feature for testing process.More info: https://pytest-vcr.readthedocs.io/en/latest/ Fixes #2386
I made a mistake on the test and fixed another bug, but not the one we originally talked about. |
@sergerdn I think it may be that the information I gave is not accurate enough
|
It appears that it was executed before adding:
|
No, it was executed after adding the data and confirming that kibana saw the data, so I guess some key data initialization was missing that caused the inconsistency between the two structures |
I believe you are correct. An index was created, but with incorrect mappings. Right mappings:
Wrong mappings:
|
Thank you very much for your help. I have fixed it! When it will be merged, please test it on your end to ensure that the new changes is working properly. |
…ests (#2445) Using `pytest-vcr` in integration tests has several benefits. Firstly, it removes the need to mock external services, as VCR records and replays HTTP interactions on the fly. Secondly, it simplifies the integration test setup by eliminating the need to set up and tear down external services in some cases. Finally, it allows for more reliable and deterministic integration tests by ensuring that HTTP interactions are always replayed with the same response. Overall, `pytest-vcr` is a valuable tool for simplifying integration test setup and improving their reliability This commit adds the `pytest-vcr` package as a dependency for integration tests in the `pyproject.toml` file. It also introduces two new fixtures in `tests/integration_tests/conftest.py` files for managing cassette directories and VCR configurations. In addition, the `tests/integration_tests/vectorstores/test_elasticsearch.py` file has been updated to use the `@pytest.mark.vcr` decorator for recording and replaying HTTP interactions. Finally, this commit removes the `documents` fixture from the `test_elasticsearch.py` file and replaces it with a new fixture defined in `tests/integration_tests/vectorstores/conftest.py` that yields a list of documents to use in any other tests. This also includes my second attempt to fix issue : #2386 Maybe related #2484
hi, I'm using version 0.0.186 and having this error, apparently I'm experiencing the same mapping issue, do you know how can I know when this is merged and included in a release of langchain? |
Hi, I am currently using version 0.0.248 and I still encounter this issue. Is there any way that I can address this? Thank you |
@Baro1502 try create your index with this structure before inserts |
in my case, it happened when I used different embedding models for storing and retrieving/searching. hope this feedback would be of some use as well. |
Hi
I'm using elasticsearch as Vectorstores, just a simple call, but it's reporting an error, I've called add_documents beforehand and it's working. But calling similarity_search is giving me an error. Thanks for checking
Related Environment
Test code
Error
The text was updated successfully, but these errors were encountered: