简体   繁体   中英

Fuzzy query on dates with ElasticSearch Java API

I'm trying to perform the following query through ElasticSearch Java API

{
 "query" : {
    "fuzzy" : {
        "dateOfBirth" : {
            "value" : "1944-11-30",
            "fuzziness" : "365d"
        }
    }
 }
}

I doesn't understand how to specify the fuzzines value for 365 days in this kind of query.

You can use this:

FuzzyQueryBuilder queryBuilder = fuzzyQuery("dateOfBirth" ,"1944-11-30" ).fuzziness(Fuzziness.build("365d"))

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM