Search in substring


(Arcadix Infotech Pvt.Ltd) #1

aaaghh
defagee
ccacc
aaa agh
ddgdd
rarrgrr
bbbaghjj

I have these values in Name column. I need to get only strings contains "ag". How can I implement it in elasticsearch?

GET /student/_search
    {
                  "from": 0,
                  "size": 1000,
                  "query": {
                      "bool": {
                         "must": [
                             { 
                                  "match_phrase_prefix": {
                                        "Name": "*ag*"
                                  }
                              }
                        ]
                      }
             }
        }

The query is giving only "aaa agh" as result. I think match prefix will return only those strings starts with pattern(words). Is there any other query?


(David Pilato) #2

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

I’d look at ngrams for that.


(Arcadix Infotech Pvt.Ltd) #4

Hi

Can u just check

Thanks
Aneesh


(David Pilato) #5

I already answered I think with Search in substring

I’d look at ngrams for that.


(system) closed #6

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