jeffvestal / ElasticDocs_GPT

Combining the search power of Elasticsearch with the Question Answering power of GPT
GNU General Public License v3.0
81 stars 39 forks source link

i am trying to integrata with local elasticsearch #3

Open Netmees opened 1 year ago

Netmees commented 1 year ago

i am getting this Error: UnsupportedProductError: The client noticed that the server is not Elasticsearch and we do not support this unknown product { "version" : { "number" : "7.10.2", "build_flavor" : "oss", "build_type" : "rpm", "build_snapshot" : false, "lucene_version" : "8.7.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }

and the modification for the script...

def es_connect(url, user, passwd):

Establecer la URL y las credenciales de autenticación

url = "https://localhost:9200"  # URL del clúster local
user = ""  # Nombre de usuario para acceder al clúster
passwd = ""  # Contraseña para acceder al clúster

# Crear una instancia de Elasticsearch
es = Elasticsearch(url, http_auth=(user, passwd),
    verify_certs=False)

# Realizar alguna operación en el clúster, por ejemplo, obtener información de clúster
cluster_info = es.cluster.health()

# Retornar la conexión establecida
return es

Search ElasticSearch index and return body and URL of the result

def search(query_text): url = "https://localhost:9200" # URL del clúster local user = "" # Nombre de usuario para acceder al clúster passwd = "" # Contraseña para acceder al clúster es = es_connect(url, user, passwd) verify_certs=False

i think that the error comes from the oss flavour not suported....

HawaYann commented 1 year ago

Make sure to use last version of ElasticSearch... you probably run different version on the client side (python lib). If you want to run with 7 you have to : pip install elasticsearch==7.17 and pip install eland==7.14.1b1 to match the major versions on the Python side...

My local version (below) is ok (auth) with the script, but script failed to run properly because of other issues in the code (search/field miss match)... I will like that someone confirm a successful configuration (local)... so far no success.

Note make sure to change:

#es = Elasticsearch(cloud_id=cid, http_auth=(user, passwd)) to es = Elasticsearch(cid, http_auth=(user, passwd))

version |  
-- | --
number | "8.9.0"
build_flavor | "default"
build_type | "deb"
build_snapshot | false
lucene_version | "9.7.0"
minimum_wire_compatibility_version | "7.17.0"
minimum_index_compatibility_version | "7.0.0"
tagline | "You Know, for Search"
HawaYann commented 1 year ago

I finally made it work locally, my mistake was my advice :-). My own elastic python agent was not at the last version. After updating elasticsearch and eland library the script elasticdocs_gpt.py is running as expected!

JMaatouk1 commented 11 months ago

I finally made it work locally, my mistake was my advice :-). My own elastic python agent was not at the last version. After updating elasticsearch and eland library the script elasticdocs_gpt.py is running as expected!

How did you get it to search against your local elasticsearch data? I keep getting "ChatGPT: I'm unable to answer the question based on the information I have from Elastic Docs" for whatever I try to search. Thank you