Can some let know how to write below query in elasticsearch

(
(
TITLE:"same old song and \\(dance)"^100
OR (
TITLE:same~0.8 AND TITLE:old~0.8 AND TITLE:song~0.8 AND TITLE:and~0.8 AND TITLE:??dance?~0.8
)^50
OR (
TITLE:same~0.5 AND TITLE:old~0.5 AND TITLE:song~0.5 AND TITLE:and~0.5 AND TITLE:??dance?~0.5
)^10
OR TITLE:"same old song and \"~3^7
)^500
AND (
COMPOSERS:perry ~2^2 OR COMPOSERS:tallarico ~2^2 OR COMPOSERS:perry, tallarico~2^2
)
)^100

You could use it as-is with the query_string query but I assume you are trying to use the DSL. What specific issue are you encountering?

Hi @jpountz,

TanQ for ur reply. But I want to run this query through .Net code. Before that I want to test the query through Sense. Can u plz let me know how to write this query for running in Sense.

Thanks,
Vani Aravinda

This should look something like this:

GET my_index/_search
{
  "query": {
    "query_string": {
      "query": "( ( TITLE:\"same old song and \\(dance)\"^100 OR ( TITLE:same~0.8 AND TITLE:old~0.8 AND TITLE:song~0.8 AND TITLE:and~0.8 AND TITLE:??dance?~0.8 )^50 OR ( TITLE:same~0.5 AND TITLE:old~0.5 AND TITLE:song~0.5 AND TITLE:and~0.5 AND TITLE:??dance?~0.5 )^10 OR TITLE:\"same old song and \"~3^7 )^500 AND ( COMPOSERS:perry ~2^2 OR COMPOSERS:tallarico ~2^2 OR COMPOSERS:perry, tallarico~2^2 ) )^100"
    }
  }
}

Hi @jpountz,

TanQ for ur quick reply. I'm able to run the query as u suggested. But Fuzziness '~' is not working if I write query like that. Is there anything I'm missing. Plz let me know.

Thanks,
Vani Aravinda

Can you elaborate on what is not working?

Hi @jpountz,

There was a slight mistake in query. I changed it and now it is working fine.

Thanks,
Vani Aravinda

Hi @jpountz

I found in one of the article that Boost is Deprecated in 1.0.0.RC1. See Function score instead of boost. Can you please let me know how to use the Function score in my above query.

Thanks,
Vani Aravinda