# Unable to index JSONB column from Postgresql View

**URL:** <https://discuss.elastic.co/t/unable-to-index-jsonb-column-from-postgresql-view/93310>\
**Category:** Logstash\
**Created:** [July 16, 2017, 5:04pm UTC](https://discuss.elastic.co/t/unable-to-index-jsonb-column-from-postgresql-view/93310 "2017-07-16T17:04:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sean\_lindo](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@sean\_lindo](https://discuss.elastic.co/u/sean_lindo)\
**Post date:** [July 16, 2017, 5:04pm UTC](https://discuss.elastic.co/t/unable-to-index-jsonb-column-from-postgresql-view/93310/1 "2017-07-16T17:04:11Z")

</div>

Hi all,

I have a view in Postgres with a single column of type jsonb. To get around some weirdness, I decided to update the view and cast this column as text (it appears I'm not able to access a PGObject, hence the update). When the rows are processed, they're processed with "search\_documents" as the top level key in the object and the original JSON object as the value. This isn't quite what I was looking for, the JSON in these columns are already objects and they're also valid JSON. Below is my configuration.

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:postgresql://host:5432/master?user=xxx&password=xxx"  
jdbc\_user =\> "xxx"  
jdbc\_validate\_connection =\> true  
jdbc\_driver\_library =\> "/usr/share/java/postgresql-jdbc4-9.2.jar"  
jdbc\_driver\_class =\> "org.postgresql.Driver"  
statement =\> "SELECT search\_documents from views.constructed\_documents"  
jdbc\_fetch\_size =\> 10000  
}  
}  
filter {  
json {  
source =\> "[search\_documents][value]"  
}  
}  
output {  
stdout {  
codec =\> rubydebug  
}  
}

---

<div class="post-metadata">

**Author:** ![sean\_lindo](https://avatars.discourse-cdn.com/v4/letter/s/e9c0ed/32.png) [@sean\_lindo](https://discuss.elastic.co/u/sean_lindo)\
**Post date:** [July 16, 2017, 5:14pm UTC](https://discuss.elastic.co/t/unable-to-index-jsonb-column-from-postgresql-view/93310/2 "2017-07-16T17:14:09Z")

</div>

Update:

I've also tried constructing my JSON objects with a vanity key, like this:

{ "value" : { "rest\_of\_my\_document" : "" } }

But, no matter what I do, whatever comes out of Postgres is indexing into Elasticsearch. It seems as if the JSON filter is not having an impact at all.

---

<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:** [August 13, 2017, 5:14pm UTC](https://discuss.elastic.co/t/unable-to-index-jsonb-column-from-postgresql-view/93310/3 "2017-08-13T17:14:18Z")

</div>

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