HI
I am very new to elasticsearch. I am trying to search by name(User can enter firstname or lastname). For example if they give 'John' i should get john and also 'Jhonson'. But my current query is giving only john.
Can anyone help me with this.
below is my current query:
{
"query": {
"bool": {
"must": [
{
"match": {
"name": {
"query": "lee"
}
}
},
{
"match_phrase": {
"isValid": true
}
}
],
"filter": {
"bool": {
"must": [
{
"nested": {
"path": "practices",
"inner_hits": {
"size": 10000,
"_source": {
"includes": "practices.id"
}
},
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"bool": {
"must": [
{
"match_phrase": {
"practices.practiceType": "pcp"
}
},
{
"range": {
"practices.effectiveDate": {
"lte": "2018-09-10"
}
}
},
{
"range": {
"practices.terminationDate": {
"gte": "2018-09-10"
}
}
},
{
"match_phrase": {
"practices.isDirectoryIndicator": true
}
},
{
"match_phrase": {
"practices.prefix": "COMM"
}
},
{
"match_phrase": {
"practices.isValid": true
}
},
{
"nested": {
"path": "practices.addresses",
"inner_hits": {
"size": 10000,
"_source": {
"includes": "practices.addresses.id"
}
},
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"bool": {
"must": [
{
"match_phrase": {
"practices.addresses.state": "CA"
}
},
{
"match_phrase": {
"practices.addresses.directoryIndicator": "I"
}
},
{
"range": {
"practices.addresses.effectiveDate": {
"lte": "2018-09-10"
}
}
},
{
"range": {
"practices.addresses.terminationDate": {
"gte": "2018-09-10"
}
}
}
],
"must_not": [
{
"match_phrase": {
"practices.addresses.type": "REM"
}
}
]
}
}
}
}
}
}
],
"must_not": []
}
}
}
}
}
}
],
"must_not": []
}
}
}
},
"size": 10000,
"from": 0
}