**I have a text file which contains some names like below:
Tom,
Harry
Robert
Harry
Matt
Tremp
I want to index those names in ElasticSearch using JAVA APIs which should index all the names automatically.
Can anybody suggest any solution as I am new to ElasticSearch
Thanks in advance**
Related
I want to create search suggestions based on the tokens (and not full documents) that are present in my index.
For example:
I have a simple index for movies in which I have these two documents:
{"name":"Captain America"}
{"name":"American Made"}
If I type "ame" then I should get two suggestions (as tokens)
america
american
Similarly if I type "cap" then I should get "captain" and not "Captain America"
I am having exact same problem as this post:
https://discuss.elastic.co/t/elasticsearch-autocomplete-suggest-by-token/18392
I have gone through all types of suggesters and seems like they are focused on returning the whole documents rather than the tokens.
Apache Solr serves this requirement through its autosuggest functionality:
For example, if I type “kni“ then Solr would return knives, knife and knit as suggestions (based on the tokens coming from the indexed documents)
{
"responseHeader":{
"status":0,
"QTime":19},
"spellcheck":{
"suggestions":[
"kni",{
"numFound":3,
"startOffset":0,
"endOffset":3,
"suggestion":["knives",
"knife",
"knit"]}],
"collations":[
"collation","knives"]}}
One of the probable solution is mentioned in this StackOverflow thread:
Elasticsearch autocomplete or autosuggest by token
But it relies on explicitly adding all the suggestions in every document. This seems to be a tedious approach.
Please let me know if this can be achieved somehow in a better way.
Thanks in advance.
It wont return the part like America when you search as "ame" because its stored as "Captain America". You get the original text which is stored
You need to store it as only America.
In your case you the the field name has value "Captain America".
If you are applying the text field type for it, it may be creating tokens for you like Captain, America etc.
These are the token created at the time of indexing and created to help you in search/auto suggest.
As a response of search or autosuggest you will get the original text.
Although the alternative way is to highlight the matching term or part of the term from the response of original text of the autosuggest.
In Access 2013...
How can I search all the queries for a particular table name?
How can I find all the queries that include the UPDATE command?
How can I search all the tables for a particular field name?
Thanks.
You should give this a try. Essentially, you can export your objects into a text file, and do a search there.
Say we have an documents to index all students information (fields city & name) .
At a point If I want to update city of all students with prefix like "NY -" all in one strech. Can this be done?
eg:
David Auburn
Jack Jamestown
Claire Newburgh
Now I need an Single API or ES call which changes all the above documents to
eg:
David NY-Auburn
Jack NY-Jamestown
Claire NY-Newburgh
I know there is way we can do it one update for each document. but i need ALL DOCUMENTS IN ONE GO
Thanks
Mahesh
Update by query does not exist in ES. I don'think the underlying lucene indices have a way to update, they delete and re-add always.
There is some talk about it becoming a thing, maybe in 1.0?
There is a plugin that can do update by query
You could write a quick script to read and re-post all your docs using any of the ES clients.
I had indexed the document and I am able to search content of document.
But I want to find the type of document is indexed, author of document , name of document, size of document basically properties of file.
How it can be achieved with the help of elasticsearch.
Thank You.
Use elastic search head to take a look at the index tika generated in ElasticSearch for you
http://mobz.github.io/elasticsearch-head/
Then you can search on those fields by using queries like author:Lav (assuming you found a field named author in your index)
I want to use search from database on my website, so I think about effective algorithm to use.
For example if I try to search "Hello my name is xxx" I want to see results:
Hello my name is John
Hello my name is Peter
Hello mr. xxx
His name is Peter
He is here
So I want to search all data from database with part of this text and sort result by number of matching words.
I made algorithm but I am pretty scared that it's so complicated and slow:
I split search text into words and use SQL select with multiple like or commands. Then I save this results into list. Then I count up numbers of matched words in each result and sort it by this count.
Problem is that when I will try to search long text.
Should I use better algorithm or should I learn somethink about thinks like Sphinx
For the first two results, a simple regex search should be able to retrieve results like that.
For the later ones, you might consider using an existing searching library thing, like Google Search Appliance, which can be used to search database information.