# DataTable in json

**URL:** <https://discuss.elastic.co/t/datatable-in-json/122211>\
**Category:** Elasticsearch\
**Created:** [March 2, 2018, 8:30am UTC](https://discuss.elastic.co/t/datatable-in-json/122211 "2018-03-02T08:30:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 2, 2018, 8:30am UTC](https://discuss.elastic.co/t/datatable-in-json/122211/1 "2018-03-02T08:30:24Z")

</div>

Hello,I'm going to use elasticsearch with php so i need to make some queries using json.0  
i've searched throw the documentation but i didn't find how to make a datatable using json.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 2, 2018, 8:43am UTC](https://discuss.elastic.co/t/datatable-in-json/122211/2 "2018-03-02T08:43:11Z")

</div>

What is a datatable? Could you give an example of what you are looking for?

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 2, 2018, 8:45am UTC](https://discuss.elastic.co/t/datatable-in-json/122211/3 "2018-03-02T08:45:26Z")

</div>

in kibana visulasation you can create a Data Table that creates a Table where the columns are the fields of the index.  
i want to do the same but with php

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 2, 2018, 9:01am UTC](https://discuss.elastic.co/t/datatable-in-json/122211/4 "2018-03-02T09:01:34Z")

</div>

what i want is to get for example the first field and to diplay it all.  
then i can put it in a column of a table

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 2, 2018, 11:21am UTC](https://discuss.elastic.co/t/datatable-in-json/122211/5 "2018-03-02T11:21:10Z")

</div>

I found the solution but i still need to add a filter

```
GET /_search
{
    "size":10,
    "query": {  
        "type" : {
            "value" : "project"
       }
    }
}
```

---

<div class="post-metadata">

**Author:** ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)\
**Post date:** [March 2, 2018, 1:03pm UTC](https://discuss.elastic.co/t/datatable-in-json/122211/6 "2018-03-02T13:03:06Z")

</div>

Solved , i found that for elasticsearch 5.x and 6 i need a bool filter:

```
   "query": {
          "bool": {
               "filter": {
                    "term": {
                       "column4": "error"
                                                   }
                                     }
                               }
                        }
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 30, 2018, 1:03pm UTC](https://discuss.elastic.co/t/datatable-in-json/122211/7 "2018-03-30T13:03:13Z")

</div>

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