Filter by one filed and all documents and visualizations they be filter

Hello everyone,

I have one index and two documents. If i want create new dashboard with two visualizations. How can I do to see all documents?

delete test
put test
{
"mappings" : {
"test" : {
"properties" : {
"nhc":{"type":"integer"},
"date":{"type":"date"},
"field1":{"type":"text"},
"field2":{"type":"text"}
}
}
}
}

put test/test/1
{
"nhc":12345,
"date":"2017-05-02",
"field1":"Hello"
}

put test/test/2
{
"nhc":12345,
"date":"2017-05-03",
"field2":"Bye"
}

I have each document in different visualizations, If i filter with field2, i don't see the field1 with document1. How I do to see twice documents?

Thanks.

Elasticsearch is actually giving you what you asked for here. You've said "I want to see documents where field2 is some value," but in the case of the first document, that field has no value, so of course it does not match what you asked for.

Sounds like maybe you have some issue with the data schema here. Why would you have some documents that contain field1 and others that do not. Same question with field2. Maybe there's a better way to structure the schema...

Hello,

Because i want load all information everyday...if one day for the same "nhc" (id) i have field1, but not field2, and next week i put new document with field2....how i can visualize correctly?

I need have the information every day.

Thanks.

Whether the field exists or not is sort of besides the point though. Here's an example.

Say you have a schema/mapping that uses the volume of an item, so you expect to have a height, a depth, and a width.

{
"id": 1234,
"name": "box",
"height": 4,
"depth": 10,
"width": 4
}

Pretty simple. But now, what happens when you index an item without a height, like say, a piece of paper. You have 2 options, you could leave off the property, of you could set it to 0. (I realize that paper has a height, but just stick with me here...)

{
"id": 456,
"name": "paper",
"width": 8.5,
"depth": 11
}

Now if you query for all items with a depth greater than 1, or with a volume of a certain number, "paper" won't show up. It doesn't matter if you put a value in there or not, paper has no volume either way.

Your situation is basically the same, you have a document that doesn't have a value for a given property, which effectively means that the document can not match when you search/filter on that property. There's logically no difference between it not existing and not having a value in the range you filtered on.

I still think this may just be a problem with the way the documents are being stored though. Knowing more about the specifics of what you are storing might be helpful in helping you find a solution. What is the data, and why would some properties not have a value?

Hello,

Thanks for you reply.

The problem is that If one day I have some fields or information about one ID, and another day will recived new information and new fields informed that before wasn't informed, I can not to visualize all fields, because the data was in different documents.

Documents:
{
"nhc":12345,
"date":"2017-05-02",
"field1":"Hello"
}

{
"nhc":12345,
"date":"2017-05-03",
"field2":"Bye"
}

If I put field1 and field2 in the same graphic or visualization, Kibana never return the record where nhc=12345.

If you're using a field in an aggregation (as an axis, or field to split lines/bars/pies on for example), then yes, that's true. Because again, you are effectively asking for a field that does not exist.

That's why I'd like to know what this data actually is, because I might be able to help you structure it differently in a way that would work.

Hello,

There are my documents:

{
"id":12345,
"date_obx":"2017-06-30",
"height":165,
weight":65
}

{
"id":12345,
"date_obx":"2017-07-01",
"fever":"Yes",
"temperature":39.5
}

The data that I want load are a healthcare data.

Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.