jillesvangurp / kt-search

Multi platform kotlin client for Elasticsearch & Opensearch with easily extendable Kotlin DSLs for queries, mappings, bulk, and more.
MIT License
107 stars 23 forks source link

[DOCS] Would be nice to have something about searching for non-string values. #22

Closed sleekweasel closed 1 year ago

sleekweasel commented 2 years ago

Describe the issue

I'm trying to query on an integer field. I have the below working, but it took some digging to work out - could you drop something like this into the docs? (or something better!)

        query =
            bool {
                filter(
                    listOf(
                        disMax {
                            queries(
                                listOf(
                                   ESQuery("match_phrase", JsonDsl().apply {
                                        put("tc_build_id", 18941877)
                                    }),
                                    ESQuery("match_phrase", JsonDsl().apply {
                                        put("tc_build_id", 18992070)
                                    })
                                )
                            )
                        }
                        , matchPhrase("type", "scenario")
                    )
                )
            }

And I know I could lose the 'listOf' calls, but I'm leaving them in because I need to build the lists programmatically in my final code. :)

Will you be able to help with a pull request?

Sure - let me know if the above is acceptable as an example, and where you want it.

jillesvangurp commented 1 year ago

not sure what you want here. You want to do text matching on numeric fields?