# Searching string terms within arrays

**URL:** https://discuss.elastic.co/t/searching-string-terms-within-arrays/205125
**Category:** Elasticsearch
**Created:** [October 24, 2019, 5:59pm UTC](https://discuss.elastic.co/t/searching-string-terms-within-arrays/205125 "2019-10-24T17:59:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Joao\_D\_Junior](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joao_d_junior/32/42635_2.png) [@Joao\_D\_Junior](https://discuss.elastic.co/u/Joao_D_Junior)
#### Post date: [October 24, 2019, 5:59pm UTC](https://discuss.elastic.co/t/searching-string-terms-within-arrays/205125/1 "2019-10-24T17:59:28Z")

</div>

I am trying to search for a particular element within an array through a term, but when querying, I get nothing p.s: I am using elasticsearch 7.x.

I created the following query:

```auto
POST spring/_search
{
  "query": {
    "nested": {
      "path": "paragrafos",
      "score_mode": "avg",
      "query": {
        "bool": {
          "must": {
            "match": {
              "paragrafos.conteudo": """4 | Chapter 1: Terms\r?\n"""
            }
          }
        }
      }
    }
  }
}

```

my mapping is:

```auto
PUT spring/
{
  "mappings": {
    "properties": {
      "downloadUrl": {
        "type": "text",
        "fielddata": true,
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "nome": {
        "type": "text",
        "fielddata": true,
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "paginas": {
        "type": "nested",
        "properties": {
          "numeroPagina": {
            "type": "long"
          },
          "paragrafos": {
            "type": "long"
          }
        }
      },
      "paragrafos": {
        "type": "nested",
        "properties": {
          "conteudo": {
            "type": "text",
            "fielddata": true,
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "paginaNumero": {
            "type": "long"
          }
        }
      }
    }
  }
}

```

and my data is:

```auto
"id" : null,
"nome" : "BigData",
"downloadUrl" : "https://jdjscm.s3-us-west-2.amazonaws.com/teste/LEITE%2C+Carlos+Henrique+Bezerra.+Curso+de+Direito+Processual+do+Trabalho+(2015).pdf",
"paginas": [],
"paragrafos": [{"conteudo":"data", "paginaNumero": 5}, {"conteudo":"test", "paginaNumero": 6}, {"conteudo":"view", "paginaNumero": 7}

```

```auto
{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  }
}

```

Is there an error in my query?

Is there an error in my query?

I've tested with filtered and filter, but returns all unfiltered objects;

---

<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: [November 21, 2019, 5:59pm UTC](https://discuss.elastic.co/t/searching-string-terms-within-arrays/205125/2 "2019-11-21T17:59:39Z")

</div>

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