Although my fields are visible in the discover tab, I can't make any kind of visualization with them and i got this message:
No results displayed because all values equal 0.
This is the data in the discover tab:
Visualise data result:
**index mappings:*
{
"mapping": {
"httpbeat": {
"_meta": {
"version": "5.2.1"
},
..........
"response": {
.....
"headers": {
"type": "nested",
"properties": {
"Content-Type": {
"type": "keyword",
"ignore_above": 1024
},
"Date": {
"type": "keyword",
"ignore_above": 1024
},
"X-Application-Context": {
"type": "keyword",
"ignore_above": 1024
}
}
},
"jsonBody": {
"type": "nested",
"properties": {
"classes": {
"type": "long"
},
"classes_loaded": {
"type": "long"
},
"classes_unloaded": {
"type": "long"
},
"counter_status_200_health": {
"type": "long"
},
"counter_status_200_login": {
"type": "long"
},
"counter_status_200_metrics": {
"type": "long"
},
"counter_status_302_unmapped": {
"type": "long"
},
"gauge_response_health": {
"type": "long"
}, ..}
any help please?
Kibana index pattern :
PS: The JSON code of the mapping is not completed due to the post rules.
Simply, the error message indicates that there is nothing shown regarding your aggregation, metric, time range etc. Therefore, even though documents exist on elasticsearch, they cannot be drawn on a visualisation. In order to solve the issue:
select the aggregation method considering field data type
set a suitable metric along with the right time range which returns some result
[Solution]
I found a solution for that, in fact httpbeat 5.6.x cannot work with kibana , only httpbeat v4.1.0 is supported ! so to visualize data you have to change the version of httpbeat (the other version give nested json documents and the nested fields are not supported with kibana )
Related
I'm very new to Using AVRO Schema and I have a use case where I need to validate AVRO schema data with regular expressions. I mean the field value can allow Numbers OR only allow Alphabets OR AlphaNumeric values OR fixed min-max length etc. I tried like below but it's not working. if any idea please assist me for the same .
AVRO schema is :
{
"type": "record",
"name": "Employee",
"namespace": "com.test.avro",
"fields": [
{
"name": "empId",
"type": "string",
"pattern": "[1-9]"
},
{
"name": "empName",
"type": "string",
"pattern": "[a-zA-Z]"
},
{
"name": "createdDate",
"type": "string",
"pattern": "^[1-9]$"
},
{
"name": "mobile",
"type": "string",
"pattern": "^[1-9]*$"
}
]
}
Thanks in Advance.
I am getting the below Json Response by hitting a RestAPI.
**
[
{
"index": 0,
"object": {
"attributes": {
"ID": [
{
"type": "configuration/entityTypes/Customer/attributes/ID",
"ov": true,
"value": "5",
"uri": "entities/attributes/ID/2Cqf5xG2"
},
{
"type": "configuration/entityTypes/Customer/attributes/ID",
"ov": true,
"value": "3028",
"uri": "entities/attributes/ID/fto38ZRR"
}
],
"IgpId": [
{
"type": "configuration/entityTypes/Customer/attributes/IgpId",
"ov": true,
"value": "1911",
"uri": "entities/attributes/IgpId/20ft8omYM"
}
],
"IgpName": [
{
"type": "configuration/entityTypes/Customer/attributes/IgpName",
"ov": true,
"value": "Dr. heath",
"uri": "entities/attributes/IgpName/20ft8oe1q"
}
],
"IgpID": [
{
"type": "configuration/entityTypes/Customer/attributes/IgpID",
"ov": true,
"value": "1872",
"uri": "entities/attributes/IgpID/20ft8oiI6"
}
],
"IgpNAME": [
{
"type": "configuration/entityTypes/Customer/attributes/IgpNAME",
"ov": true,
"value": "Dr Jc crook",
"uri": "entities/attributes/IgpNAME/20ft8oqoc"
}
]
}
},
"successful": true
}
]
**
I am trying to save the values for CoachID (3028), IgpID(1872), IgpId(1911), IgpName(Dr. heath), IgpNAME(Dr Jc crook) in String variables in APex class.
I have used a map to do so but unable to get the proper values. I wanted to get the above values in a List & return that list from function.
Can anyone help me on this? I am not supposed to do this using wrapper.
Regards,
Mohit
It can't be done as straight "JSON.deserialize" call because some fields are reserved keywords in Apex. How strict the wrapper ban is? I wouldn't want to type this stuff freehand but you can go to https://json2apex.herokuapp.com/, tick checkbox about explicit parser (again, since you have reserved keywords it'd happen anyway) and well, you have a ready class & cool stab at unit test / example how to use the code. It's battle-tested, if you can't use that then your project has bigger problems ;)
If you really really have to do it alone and with maps it'll be something like https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_System_Json.htm, example for deserializeUntyped
Trying to serialize Java Objects represented as a Map. This requires me to build an Avro Schema first. I am using Avro SchemaBuilder for schema generation. Have already succeeded in schema generation for Map's objects. However can't deal with schema building for overall Map.
Final schema should look like the following (created this one manually):
{
"type": "record",
"name": "MapObject",
"namespace": "test",
"fields": [
{
"name": "CacheMap",
"type": {
"type": "map",
"values": [
{
"type": "record",
"name": "User",
"namespace": "test",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "status",
"type": "string"
}
]
},
{
"type": "record",
"name": "UserKey",
"namespace": "test",
"fields": [
{
"name": "key",
"type": "long"
},
{
"name": "keyPrint",
"type": "string"
}
]
}
]
}
}
]
}
How can I pass to different records for key and value of a map in SchemaBuilder?
SchemaBuilder.map().values() does not allow to pass more than one Schema as a parameter for .value().
Apache Avro Unions can be of help here.
SchemaBuilder.builder()
.map()
.values(SchemaBuilder.unionOf().type(firstSchema).and().type(secondSchema).endUnion());
where the firstSchema and the secondSchema are separate schemas already defined for required User and UserKey 'records' (considering the schema from question)
I have indexed my pdf file in elastic search using ingest-attachment processor plugin and now am search my file based on the contents available in PDF.
For Example, am having some contents like this in my pdf.
Hello I m Karthikeyan. My mail id Karthikeyan#gmail.com, My mob no 4573894833.
While am searching using Java API, am able to search like the following.
Search For,
Karthikeyan#gmail.com am able to get the file.
But,
If i search for,
#gm means am not able to get the file, am expecting that i should get the file because, this file have my search keyword #gm.
How can i do this. ?
Am using tokenizer with min_gram & max_gram as 3 each.
Please find the below java api that i have used, but none of them giving me the results as expected.
QueryStringQueryBuilder attachmentQB = new QueryStringQueryBuilder("#gm");
Please find my below mappings details.
PUT attach_local
{
"settings": {
"analysis": {
"analyzer": {
"custom_analyzer": {
"type": "custom",
"tokenizer": "my_tokenizer",
"char_filter": [
"html_strip"
],
"filter": [
"lowercase",
"asciifolding"
]
}
},
"tokenizer": {
"my_tokenizer": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
"mappings": {
"doc": {
"properties": {
"attachment": {
"properties": {
"content": {
"type": "text",
"analyzer": "custom_analyzer"
},
"content_length": {
"type": "long"
},
"content_type": {
"type": "text"
},
"language": {
"type": "text"
}
}
},
"resume": {
"type": "text"
}
}
}
}
}
You can see how ES tokenizes your search text using
POST /attach_local/_analyze
{
"analyzer": "custom_analyzer",
"text": "#gm"
}
That will tell you if the # character is dropped or not. If it is then that would explain the behavior since your inverted index has all trigrams and you are searching for a bigram.
I am unable to parse this JSON file.
Any suggestions are appreciated. I have created POJO classes from http://www.jsonschema2pojo.org/ I tried JSON deserilization solution mentioned but it did not work out for me.
{
"error": "",
"data": [
{
"view": "Viewpapger",
"data": [
{
"view": "ImageView",
"data": {
"url": "random.jpg"
},
"properties": {
"width": "fill_parent",
"height": "500"
}
},
{
"view": "Textview",
"data": {
"text": "afvnjkafvf"
},
"properties": {
"width": "fill_parent"
}
},
{
"view": "Textview",
"data": {
"text": "afvnjkafvf"
},
"properties": {
"width": "fill_parent"
}
},
{
"view": "ImageView",
"data": {
"url": "random.jpg"
},
"properties": {
"width": "fill_parent",
"height": "500"
}
}
],
"properties": {
"width": "wrap_content",
"height": "500"
}
},
{
"view": "Textview",
"data": {
"text": "afvnjkafvf"
},
"properties": {
"width": "fill_parent"
}
},
{
"view": "ImageView",
"data": {
"url": "random.jpg"
},
"properties": {
"width": "fill_parent",
"height": "500"
}
}
]
}
I think the problem here is that the JSON structure does not correspond to any strictly specified schema but seems more like an ad-hoc collection of keys and values. For example, (it seems that) depending on the value of the view field in your view description object the data field can be either
a JSON array containing other view descriptions (for "Viewpager")
a JSON object containing a string called "url" (for "ImageView")
a JSON object containing a string called "text" (for "TextView")
So, basically it seems that data can be anything and moreover that you could have an arbitrarily deep tree of nodes where data could be anything at any level in the tree. (It may be different though if, for example, you can always be certain that the top level element is a "Viewpager" that contains one level of sub-views like "ImageView" or "TextView" - if you have any guarantees like that let me know).
In that case I think you are better off parsing the JSON in some other, less strict way (maybe using org.json.JSONArray and org.json.JSONObject) and then handling all the different cases "manually".