Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
how to fetch items if any search keyword matched?

I have this document in my elastic DB.I am using this package https://www.npmjs.com/package/@elastic/elasticsearch

I am searching on title.

I am doing like this.

const result= await client.search({
      index: 'products',
      "query": {
        "bool": {
          "should": [
            {
              "wildcard": { "title": "*" + search + "*" }
            }
          ],
          "minimum_should_match": 1
        }
      }

when I search "title" this issue . it give me one result but When I am seacrhing i have issue . it is giving zero or 0 result.why ? is it possible to fetch that data.issue keyword is present in first collection why it is not picking ?

[
  {
    "_index": "products",
    "_id": "wZRh3n8Bs9qQzO6fvTTS",
    "_score": 1.0,
    "_source": {
      "title": "laptop issues",
      "description": "laptop have issue present in according"
    }
  },
  {
    "_index": "products",
    "_id": "wpRh3n8Bs9qQzO6fvzQM",
    "_score": 1.0,
    "_source": {
      "title": "buy mobile",
      "description": "mobile is in Rs 250"
    }
  },
  {
    "_index": "products",
    "_id": "w5Rh3n8Bs9qQzO6fvzTz",
    "_score": 1.0,
    "_source": {
      "title": "laptop payment",
      "description": "laptop payment is given in any way"
    }
  }
]

how to search on keywords? any keyword match . I need to pick that whole colloection

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you want to match only some of the word from query then you can use match query with operator set to or.

{
  "query": {
    "match": {
      "title": {
        "query": "i have issues",
        "operator": "or"
      }
    }
  }
}

Update

To run the query which you mentioned in comment, You can use match_bool_prefix query.

{
  "query": {
    "match_bool_prefix": {
      "title": {
        "query": "i have issu"
      }
    }
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda