How to search Json message in Kibana elasticSearch - elasticsearch

I am using ElasticSearch Kibana dashboard with the following fields
host
_id
_score
index
message
of which message is a json string having values like
{"version": "3.4.2", "model": "EX2308", "orders": "50"}
I am searching for lucene query to search this JSON message having
orders > 30 and version > 3.4
Any help is appreciated
[Updated]
I am using logback-elasticsearch-appender to push messages into ElasticSearch using SLF4j
log.info(new org.json.JSONOject(arg).toString());

You can simply input the following Lucene query into the search field:
message.orders:>30 AND message.version:>3.4

Related

Kibana - update default search query

I am new to elastic search and Kibana. In Kibana, while trying to fetch elastic search document in json, by default a bsearch query been executed with wildcard field search as below
fields: [{field: "*", include_unmapped: "true"}, {field: "timestamp",
format: "date_time"}]
This in turn returns all the document values as array under fields section. I need to turn off requesting fields in search query and its enough to have _source metadata in my json.
How to update the default query been searched in kibana? Thanks in advance
Installed elastic search version - 7.17.3
In Advanced Settings, you can turn on "Read fields from source" instead of using the Fields API, but it's soon going to be deprecated:

Elastic search query string shows documents that do not have specified key

In version 6.7.1 elastic search, I am using the query string to get some documents. After executing the query string, in addition to the actual documents, it gives those documents also which does not have the key against which data is filtered.
This was not the case when I was using 6.4.2 elastic version. The official site does not have any information regarding that.
My query looks like -
"* AND ( properties.foreignKeys.referenceTableId :(file_datatypes) OR properties.primaryKeyMetadata.referenceTables :(file_datatypes) )".
It shows the documents that has properties.foreignKeys: null and properties.primaryKeyMetadata: null, in json
Any update will be helpful.

Term aggregation using template in Grafana with Elasticsearch as data source

I have a doc in Elasticsearch with different fieldnames, eg: a,b,c,d...
I want to use templating in Grafana to query a term aggregation in such way that I get the values in a field. eg: i.
I'm trying to use this query:
{"find":"terms","field":"i","size":25}
but it does not return any values.
I know that there are some values as I query the same docs with Sense.
I have Grafana v 4.6.2 and Elasticsearch v 2.3.4
The field I wanted has a "-" in the string. ES sees it as a separator, this was the reason of the error.
Changing the field's mapping to "not analyzed" should help.

Spring boot elastic not giving expected result

I am querying elastic through spring boot.
case:- 1
There is some data in my elastic like region = "REGION 1"
I want to get all the data where "REGION 1", but getting an empty result.
case 2:-
There is some data in my elastic like region = "REGION1"
I want to get all the data where "REGION1", I am getting the exact response.
I am querying on elastic as exact field match, I am not getting why this is happening even I have made the field as not_analyzed.
I have changed all the fields to not_analyzed and wrote a term query and it worked for me.

Kibana keeps some fields unindexed

So I have an index in elasticsearch, and I want to search and visualize the index with Kibana. But several fields are not indexed by Kibana, and have this bubble:
This field is not indexed thus unavailable for visualization and search.
This is a snippet of one of the fields that is not indexed by Kibana:
"_event_name" : {
"type" : "string"
},
I tried to enter Kibana's index settings and click "Reload field list", but it doesn't help.
Does anyone knows what could be the problem?
Thanks in advance
The fields might not be indexed as mentioned here.
Apparently, Kibana doesn't index fields that start with underscore.
How are you loading the data into Elasticsearch? Logstash? A Beat? curl? Please describe that and if you can include your config file that would be good.
You can look at your mapping in your browser with something like this;
http://localhost:9200/logstash-2016.07.20/_mapping?pretty
(change the host and index name)

Resources