appbaseio / appbaseio/reactivesearch

Best way to query two fields of nested data and render results

Abierto
#1,495 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
JavaScript
Estrellas
4.9k
Forks
478
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Affected Projects**
React

**Is your feature request related to a problem? Please describe.**
I have an index with nested data (list of objects), **i want to query on two the nested fields** a) title(keyword) 2) installed at(date time range). What is the best way to achieve that when i'm using two components.
Example index data:
```json
{
"name":"John Doe",
"apps" :[
{
"name": "Call of Duty",
"installed_at":
},
{
"name": "Super Mario",
"installed_at" :
},
]
}
```
Code on Reactjs

```

/>
```

**Describe the solution you'd like**
When it is making the query for search, it is making two separate `must`s for `app.name` and `app.installed_at`. But I want
Looking for making a search taking inputs `name` and `installed_at` from two different components and make a query like this
```
GET /theindex/_search?size=500&from=0
{
"query": {
"nested": {
"path": "apps",
"query": {
"bool": {
"must": [
{ "match": { "apps.name": "RandomeApp" }},
{ "range": { "apps.installed_at":{"gte":1590949800000,"lte":1591813800000}}}
]
}
}
}
}
}
```

What is the best way to achieve this

**Describe alternatives you've considered**
None

**Additional context**
None

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.