Get the response before finishing typing the query? - elasticsearch

I am new to elasticsearch, I use it to store my dataset.
I created a IHM where I can type a query and get the response
I would like to know if there is a way to get the response before finishing typing the query
for example, I would like to look for the china, I would like to get some result while I am typing the word chi.

Related

Need to Get data for an index for a timeframe using curl or using url

I need to Get data for an index for a timeframe using curl or using url.
I was able to get the data using below created url
http://localhost:9200/index_name/_search?size=10&q="* AND severity:major|critical"
but I am not sure where to provide the timeframe for example i only want data from last 15minutes.
Can anyone help me with a way it can be done
You can do it like this by adding #timestamp:[now-15m TO now] to your query:
http://localhost:9200/index_name/_search?size=10&q="* AND severity:major|critical AND #timestamp:[now-15m TO now]"

How to get the counts of log messages based on the error type in Elasticsearch visualization

I have some sample data on the Elasticsearch, which looks like the following:
I am using the data table in the Visualize section to get the counts for each error type, for example: it should output
Error: Update failed for online booking with id, count is 5.
Not the count 1 for different id of the same error type.
What I have done is to build a query to output the counts for each error type, which looks like this:
However, when I save the query as the saved search, then visualize it as data table, it still have the same issue as above.
I was thinking to only save the output of that query as saved search, one issue is that the output is too verbose, has a lot of information I don't really need.
Any suggestions please !

Get BigQuery metadata when performing query (Ruby)

When performing a query against BigQuery, it outputs useful info in logs, but the return value is simply the query payload. Is there any way to programmatically get the query metadata in addition to the query result?
Example:
bigquery = Google::Cloud::Bigquery.new(…)
result = bigquery.query(sql)
Debug-level logs will show something like:
#total_bytes_processed=102412,
#total_rows=12915
I'm wondering how that could be accessed programmatically.
Don't know the specifics of Ruby (I don't use that language), but when you submit your query, you'll get back a "job id". Use this id to retrieve the meta information about the job/query using the Job API.
https://cloud.google.com/bigquery/docs/jobs-overview
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/get
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#resource

Couchdb get the changed document with each change notification

I'm quite sure that I want to be notified with the inserted document by each insertion in the couch db.
something like this:
http://localhost:5058/db-name/_chnages/_view/inserted-document
And I like the response to be something like the following:
{
"id":"0552065465",
"name":"james"
.
.
.
}
Reconnecting to the database for giving the actual document by each notification can cause performance issues.
Can I define a view that return the actual document by each change?
There are 3 possible way to define if a document was just added:
You add a status field to your document with a specific status for new documents.
If the revision starts with a 1- but it's not 100% accurate according to this if you do replication.
In the changes response, check if the number of revision of the document is equal to one. If so, it means it was just added(best solution IMO)
If you want to query the _changes endpoint and directly get the newly inserted documents, you can use the approach #1 and use a filter function that only returns documents with status="new".
Otherwise, you should go with approach #3 and filter the _changes responses locally. Eg: your application would receive all changes and only handle documents with revisions array count equal to 1.
And as you mentioned, you want to receive the document, not only the _id and the _rev. To do so, you can simply add the query parameter: include_docs=true

Possible to use GroupBy in ElasticSearch querystring?

I have a few records in my elasticsearch collection and i want to use a GroupBy aggregation in elasticsearch querystring.
I want to know if it is possible, because i tried to google it always give result about this
i want to use this something like this in the query string , which can
give me records in the group.
For i.e.
http://localhost:9200/_all/tweets/_count?q=user:Pu*+user:Kim*
This will give me count of all the records which has name starts from Pu and Kim,
But i want to know that how many records are there has name starting with Pu
and Kim,
aggregations need to be specified in addition in the search request, you cannot specify them as part of a query string query.
You could also just execute two queries to find out this particular requirement...

Resources