I use Elasticsearch with logs from my app.
I want to use the DevTools in order to get some of the following information:
I have log that represents "the user edited a comment" that contains:
field processId which is a number that represents that the log is for comment edit action
field commentId that represents the comment that is edited
field deviceIdentifier that represents the identifier of the device that the edit is done with
I want to get the number of comments that were edited by more than one device - meaning number of unique commentIds that have document with the appropriate processId and also have another document with the appropriate processId but the deviceIdentifier is different between the documents.
I can't find a way to do it in the DevTools documentation.
How can I do such a thing?
Thanks ahead.
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.
I want to make dependent search like when user type country and select country then on next dropdown/text search result would be from that particular Countries state, after selecting state on next text search would only based on that selected state. can anyone help to achieve this kind thing via elastic search.
i am new to elastic Search and i had basic idea of it, but didn't get idea how to do this kind of stuff where i need to search from child and feel data like map
Fist, it is important to understand how Elasticsearch store its data. You can find this kind of info here: https://www.elastic.co/guide/en/elasticsearch/reference/master/documents-indices.html
So, basically what you need is build a query with two must terms.
One for the object type (Country, State, etc).
Other for the name ("Los Angeles", "Massachussets", etc). If you want a autocomplete feature you could add a wildcard query in your list. https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html
Obs: When you store your State object do not forget to store the Country name together. Since Elasticsearch is non relational you have to have Country name indexed in the State document.
Hope that it helps
I am currently listing some files with the Google Drive API. However, the default list only lists id, name, and mimeType. I know that the fields parameter can list more than just the default, but when I put parents as a field in the Google API Playground, I get the error of Invalid field selection parents. However, when I use * in the fields parameter, it returns all the fields. Am I doing anything wrong by putting parents in the fields parameter? If so, does anyone have any idea how to include the parents field as a field in the list results?
Here is my current endpoint, which causes the error:
https://www.googleapis.com/drive/v3/files?fields=parents&key=[YOUR_API_KEY]
Thanks!
From https://www.googleapis.com/drive/v3/files?fields=parents&key=[YOUR_API_KEY], in your situation, when parents is directly put to fields as follows,
such error of Invalid field selection parents occurs. Because the method of "Files: list" returns the file list which is an array including each file metadata. Ref I think that this is the reason of your issue.
Solution:
So in this case, please set files(parents) instead of parents.
Note:
In the case of files(parents), only parents is returned. When you want to retrieve id, name, mimeType and parents, please use files(id,name,mimeType,parents) to fields.
References:
Try this API of "Files: list"
Files
I have 500 profiles, with 2 fields: name and description.
For description, it contains other profiles' name. I want to use ElasticSearch to get which profiles got mentioned in each profiles so that I can show them as related profiles.
I know how to get profiles using one profile's name and search for other's description, however in many case one profile will mention other profiles' name not bi-direction.
i.e.:
A mentions B but B does not mention A.
How to get related profiles by one's description to search for names but not the other way round? Is it possible to get it done with ElasticSearch?
Thanks
You want something like a relational join and it's not possible in ES. So the way is to fetch the desc, parse the contained profiles and then make a query. You can also try to explore new ES graph plugin
I aim doing a search feature with in squiz matrix what i am trying to do is to out put the users search term on to the results page using this:
Please note, is the name of the field that was entered when it was created on the Search
%_query_terms%
This will show the terms the user entered into the search field.
my keyword line is:
%queries_search_query_query_terms%
Can anyone help
Right click on your search asset and go to search fields screen. Note the name of your search field. Lets say it is xyz. You keyword would then be %xyz_query_terms%
OR
You can do this - %globals_get_queries_search_query%.
#Anton Palitsyn was right in their answer. From the Squiz Matrix manuals it says
%_query_terms%: where is the name of the field that was entered when it was created on the Search Fields screen. For example, if you entered the name Keyword, this will be %keyword_query_terms%. This will show the terms the user entered into the search field.
The Search Page Keyword Replacements can be found at http://manuals.matrix.squizsuite.net/search/appendices/keyword-replacements
You should check out http://manuals.matrix.squizsuite.net/search/chapters/search-page as it has all the info you need.