I am trying to read a pdf from python and send it to elasticsearch.
I tried to use ingest-attachment to help with that, but I don't know how.
https://www.elastic.co/guide/en/elasticsearch/reference/master/attachment.html
When I followed the official documentation, it worked. However, there doesn't seem to be a way to use Python in the official documentation.
so, I looked at the official documentation and created my own mapping
Data is entered but not attached.
Wandered around and found this.
but i don't know how to use
elasticsearch.exceptions.RequestError: RequestError(400, 'invalid_index_name_exception', 'Invalid index name [_ingest/pipeline/attachment_pipeline], must not contain the following characters ['\','/','*
','?','"','<','>','|',' ',',']')
If you just run it, it will come out like this: It looks like you have / in your index name. So this time I only ran the bottom part.
elasticsearch.exceptions.RequestError: RequestError(400, 'illegal_argument_exception', 'pipeline with id [attachment_pipeline] does not exist')
..........
I want to know how to use it..
How to make attachment plugin work in python
Related
Going to try asking this here.
I'm trying to write an error message from an Azure Data Factory pipeline to a table in SQL server. It needs to capture the error message from a Databricks Python job. I can't find any official documentation and the method I have found from this source:
#{activity('Proc source').error.message}
..doesn't write anything to the table. Just a blank string with no explanation.
Why data factory doesn't just have an area where you can view the details of errors instead of just saying "Failed" is beyond me. Or if it does, it's hidden away.
Does anyone have any ideas?
You can see the details of error at here.
#{activity('Proc source').error.message}
This expression works.
Is errorCode saved to your table?Make sure your activity name is correct.
SOLVED:
For anyone else reading this, the problem turned out to be something very stupid. I'd included a space in the python file name.
This returned an error code of 3202 and a blank error message.
I had another problem and resolution after this that I'd like to share, again for anyone frantically googling a solution to the problem. Once I'd removed spaces from the python filename, I logged an error code of '3204'
and the error message: "Databricks execution failed with error message: . Run page url: (link to page showing clusters)". In the Databricks workspace launchable through the Azure portal, selecting a cluster through the 'clusters' sidebar then heading to 'Driver Logs' will show errors, in the 'Standard error' window that comes up.
I had already installed the libraries I needed on an existing cluster, but I'd forgotten to change a setting in the Databricks linked service. 'Select cluster' was set to 'new job cluster' when I needed 'Existing interactive cluster'. Thus, it wasn't pointing to the cluster I had expected.
These are all fairly small errors as it turns out, but again I hope that someone else dealing with the same issues will be able to find this post and save themselves some hassle!
So, I am trying to print out gifs by using Tenor API.
I want it to only print one gif link but it prints out everything any Idea how to fix this?
Thank you.
https://i.stack.imgur.com/xf084.png
Sadly, I can not tell you the exact problem you are having, I replicated your code and used the official API Docs here
From what I can tell, this is one GIF just in a lot of different formats.
You can filter them like so:
print(top_8gifs['weburl'])
or
print(top_8gifs['results'][0])
EDIT: Looking at your .png (please embed it as code in the future) this should work for you, if you want the url:
print(top_8gifs[0]['url'])
A Python dict you can select using the key (like gifs['weburl'])
A Python list you have to select by index so gifs[0]
Using these techniques you can gather the data you need from that output.
I am currently attempting to create an issue within JIRA via API and have been running across an issue that I have no clue to fix.
I used a curl command to find the components and I got the following:
"components":[{"self":"https://jira-server/rest/api/2/component/18458","id":"18458","name":"JIRA","description":"#"},{"self":"https://jira-server/rest/api/2/component/18463","id":"18463","name":"JIRA"}]
when I run my script by using python-JIRA API with the following command:
new_issue = jira.create_issue(project='IT', summary='New issue from jira-python', description='look here', issuetype={'name': 'Task'}, components = [{'name': "JIRA"}])
I get the following error message:
response text = {"errorMessages":[],"errors":{"components":"Component name 'JIRA' is not valid"}}
Can anyone tell me what exactly I am doing wrong? I am 100% "JIRA" is a component since I manually created a test issue and selected "JIRA" as a component.
You have to make sure the Component you're linking to belongs to the same Jira Project that your issue is being created under
I believe your issue might be that you have too many brackets, components = [{'name': "JIRA"}] should be components = {'name': "JIRA"}
This is what I think your error is trying to tell you too when it says "errorMessages":[]....., the api only expects one set of brackets and passing it a set with information enclosed in another pair sets it off.
However I have not tried this solution but I do know it works when using issuetype = {'name' : 'Bug'}
Alternatively you probably don't even need the components part, it should create the issue with the other items given, if it doesn't its probably another field that only task requires. If you try to create an epic you need customfield_10814 to be filled with a description and for bug you need to fill the found at location.
The syntax is correct. components should be a list.
Did you create 'JIRA' as a component in the same project?
Make sure the component name is available for that project. If you go to any ticket in the same project, the 'dropdown' in the component section should list all the available components.
Create a component for 'JIRA' . From error it seems you project doesn't have any value called 'JIRA' .
Creation of value 'JIRA' for component will solve the problem
I'm trying to make a cms with Python to post new targets to a cloud database on vuforia. I found this Python library "python-vuforia" but it has read functionalities only.
I added a function to post targets but so far getting 401 error. you can find the new function in this commit
What am I doing wrong?
Got it working with this (commit)[https://github.com/dadoeyad/python-vuforia/commit/1997a49f94c5f2e13ab1d5c620c69160c76b7969]
I think the problem was with doing str(req.get_data()) instead of req.get_data()
and base64.b64encode(hmac(key, message, sha1).digest()) instead of hmac(key, message, sha1).digest().encode('base64')
We are currently running haystack with an elasticsearch backend. We are having trouble getting the partial word search to run correctly.
We currently have an index that has an EdgeNgramField. I have tried doing a search on this field, but I'm not finding any results unless it's an exact match. I'm trying to use this to find products so for example: I type "sun", I won't get the result for "sunglasses".
I started using curl commands directly on the elasticsearch to see if I could figure out what was happening. I even created my own index directly with curl, along with an ngram analyzer and I receive the proper results using partial word searches.
Another interesting thing is that: if I run the _mapping command using curl on my test index directly on elasticsearch that I created directly with curl, i get the following: "testfield":{"type":"string", "analyzer":"test_analyzer"}, however, if I run the mapping command on the index created by haystack, it only has "type":"string". It says nothing about the edgengram_analyzer that it should be using.
Any ideas?
I think there's a bug in haystack in elasticsearch_backend.py which is not using pyelasticsearch properly line 868 looks like:
self.conn.put_mapping('modelresult', current_mapping, index=self.index_name)
And if you replace it by:
self.conn.put_mapping(doc_type='modelresult', mapping=current_mapping, index=self.index_name)
which is how pyelasticsearch expects it, then you will see that the edgengram_analyzer is added to your EdgeNgramField field. At least it works for me.