# \[http-module\] Collecting Data from Webserver: Problem with JSON-Array

**URL:** <https://discuss.elastic.co/t/http-module-collecting-data-from-webserver-problem-with-json-array/178031>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [April 23, 2019, 11:39am UTC](https://discuss.elastic.co/t/http-module-collecting-data-from-webserver-problem-with-json-array/178031 "2019-04-23T11:39:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterPain](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@PeterPain](https://discuss.elastic.co/u/PeterPain)\
**Post date:** [April 23, 2019, 11:39am UTC](https://discuss.elastic.co/t/http-module-collecting-data-from-webserver-problem-with-json-array/178031/1 "2019-04-23T11:39:10Z")

</div>

Hey there, so i want to collect live Data from a webservice. The webservice is for compressor-monitoring and offers an interface in JSON-Format.

Demo:  
[http://www.airleader.biz/demo/index.jsp](http://www.airleader.biz/demo/index.jsp)  
Interface:  
[http://www.airleader.biz/airleader/interfaces/json.jsp](http://www.airleader.biz/airleader/interfaces/json.jsp)

I am able to get the data in Elasticsearch, but the JSON-Format from the webservice puts the status (on, off, error, etc.) in an array for each compressor under _modules_.

-

 ![Problm](https://us1.discourse-cdn.com/elastic/original/3X/1/2/124c5ffb0f92df92ac7d79f9926875a2f6d19eac.jpeg)

So i want to check for example if Compressor 1,2,3... is on error. But elasticsearch isnt able to query correctly through arrays

I gave i quick look to nested datatype, but i dont know how to use it in my case.

thx in advance for any help

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [April 26, 2019, 9:00am UTC](https://discuss.elastic.co/t/http-module-collecting-data-from-webserver-problem-with-json-array/178031/2 "2019-04-26T09:00:26Z")

</div>

I assume when you mention nested queries that is what you were looking at ? [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-nested-query.html)

Can you share the queries that you tried and didn't work?

---

<div class="post-metadata">

**Author:** ![PeterPain](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@PeterPain](https://discuss.elastic.co/u/PeterPain)\
**Post date:** [April 26, 2019, 10:01am UTC](https://discuss.elastic.co/t/http-module-collecting-data-from-webserver-problem-with-json-array/178031/3 "2019-04-26T10:01:33Z")

</div>

Hey Ruflin,

I think i need to explain my problem more detailed.  
The JSON-Interface of the website (see link above) puts the Informations of each compressor under http.airleader.mm.modules in an array of objects.

"M" = compressor is on  
"E" = compressor is on error

I am not able to modify this interface.  
So i dont have the Nested Datatypes and Elasticsearch isn't able to query through an array of objects.

Example:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/e/1e846095f39e22bbea2817c1ae4be61319b26aa4.png)  
Because its not a nested datatype i get wrong results for the query.

To solve the problem i was looking at the option of pre-processing of documents using ingest-node. But i dont know how to handle arrays of object in painless

---

<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:** [May 24, 2019, 10:01am UTC](https://discuss.elastic.co/t/http-module-collecting-data-from-webserver-problem-with-json-array/178031/4 "2019-05-24T10:01:41Z")

</div>

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