# Accessing multi fields

**URL:** <https://discuss.elastic.co/t/accessing-multi-fields/9544>\
**Category:** Elasticsearch\
**Created:** [November 4, 2012, 1:52am UTC](https://discuss.elastic.co/t/accessing-multi-fields/9544 "2012-11-04T01:52:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kennedy\_Idialu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kennedy_idialu/32/2532_2.png) [@Kennedy\_Idialu](https://discuss.elastic.co/u/Kennedy_Idialu)\
**Post date:** [November 4, 2012, 1:52am UTC](https://discuss.elastic.co/t/accessing-multi-fields/9544/1 "2012-11-04T01:52:17Z")

</div>

I am unable to access multi fields using the navigation notation.

My mapping

{  
"mappings":{  
"document":{  
"properties":{  
"tags":{  
"type":"object",  
"properties":{  
"title":{  
"fields":{  
"partial":{  
"search\_analyzer":"main",  
"index\_analyzer":"partial",  
"type":"string"  
},  
"title":{  
"type":"string",  
"analyzer":"main"  
},  
"title2":{  
"type":"string",  
"analyzer":"main"  
}  
},  
"type":"multi\_field"  
}  
}  
}  
}  
}  
},

```
"settings":{
    "analysis":{
        "filter":{
            "name_ngrams":{
                "side":"front",
                "max_gram":50,
                "min_gram":2,
                "type":"edgeNGram"
            },
            "name_ngrams_back":{
                "side":"back",
                "max_gram":50,
                "min_gram":2,
                "type":"edgeNGram"
            },
            "name_middle_ngrams":{
                "type":"nGram",
                "max_gram":50,
                "min_gram":2
            }
        },

        "analyzer":{
            "main":{
                "filter": ["standard", "lowercase", "asciifolding"],
                "type": "custom",
                "tokenizer": "standard"
            },
            "partial":{

```

"filter":["standard","lowercase","asciifolding","name\_ngrams"],  
"type": "custom",  
"tokenizer": "standard"  
}  
}  
}  
}

}

Test data

curl -XPUT localhost:9200/testindex/document/1 -d '{"title": "Fight for  
your life"}'  
curl -XPUT localhost:9200/testindex/document/2 -d '{"title": "Fighting for  
your life"}'  
curl -XPUT localhost:9200/testindex/document/3 -d '{"title": "Will you just  
start the fight"}'

Search

curl -XGET  
'localhost:9200/testindex/document/\_search?q=title:life&pretty=1'  
// Ok  
curl -XGET  
'localhost:9200/testindex/document/\_search?q=document.title:life&pretty=1'  
// Ok

// Doesn't work. I expect this to return same result as the first query.  
curl -XGET 'localhost:9200/testindex/document/\_search?q=_title.title2_  
:life&pretty=1'  
curl -XGET 'localhost:9200/testindex/document/\_search?q=\*  
document.title.title2\*:life&pretty=1'

My question is, how do I reference multi fields field when querying?

Thanks

--

---

<div class="post-metadata">

**Author:** ![Kennedy\_Idialu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kennedy_idialu/32/2532_2.png) [@Kennedy\_Idialu](https://discuss.elastic.co/u/Kennedy_Idialu)\
**Post date:** [November 4, 2012, 1:56am UTC](https://discuss.elastic.co/t/accessing-multi-fields/9544/2 "2012-11-04T01:56:30Z")

</div>

When I say it doesn't work, I mean, it returns 0 hits.

On Sunday, 4 November 2012 02:52:17 UTC+1, Kennedy Idialu wrote:

> I am unable to access multi fields using the navigation notation.
> 
> My mapping
> 
> {  
> "mappings":{  
> "document":{  
> "properties":{  
> "tags":{  
> "type":"object",  
> "properties":{  
> "title":{  
> "fields":{  
> "partial":{  
> "search\_analyzer":"main",  
> "index\_analyzer":"partial",  
> "type":"string"  
> },  
> "title":{  
> "type":"string",  
> "analyzer":"main"  
> },  
> "title2":{  
> "type":"string",  
> "analyzer":"main"  
> }  
> },  
> "type":"multi\_field"  
> }  
> }  
> }  
> }  
> }  
> },
> 
> ```
> "settings":{
> "analysis":{
> "filter":{
> "name_ngrams":{
> "side":"front",
> "max_gram":50,
> "min_gram":2,
> "type":"edgeNGram"
> },
> "name_ngrams_back":{
> "side":"back",
> "max_gram":50,
> "min_gram":2,
> "type":"edgeNGram"
> },
> "name_middle_ngrams":{
> "type":"nGram",
> "max_gram":50,
> "min_gram":2
> }
> },
> 
> "analyzer":{
> "main":{
> "filter": ["standard", "lowercase", "asciifolding"],
> "type": "custom",
> "tokenizer": "standard"
> },
> "partial":{
> 
> ```
> 
> "filter":["standard","lowercase","asciifolding","name\_ngrams"],  
> "type": "custom",  
> "tokenizer": "standard"  
> }  
> }  
> }  
> }
> 
> }
> 
> Test data
> 
> curl -XPUT localhost:9200/testindex/document/1 -d '{"title": "Fight for  
> your life"}'  
> curl -XPUT localhost:9200/testindex/document/2 -d '{"title": "Fighting for  
> your life"}'  
> curl -XPUT localhost:9200/testindex/document/3 -d '{"title": "Will you  
> just start the fight"}'
> 
> Search
> 
> curl -XGET  
> 'localhost:9200/testindex/document/\_search?q=title:life&pretty=1'  
> // Ok  
> curl -XGET  
> 'localhost:9200/testindex/document/\_search?q=document.title:life&pretty=1'  
> // Ok
> 
> // Doesn't work. I expect this to return same result as the first query.  
> curl -XGET 'localhost:9200/testindex/document/\_search?q=_title.title2_  
> :life&pretty=1'  
> curl -XGET 'localhost:9200/testindex/document/\_search?q=\*  
> document.title.title2\*:life&pretty=1'
> 
> My question is, how do I reference multi fields field when querying?
> 
> Thanks

--

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [November 4, 2012, 3:27am UTC](https://discuss.elastic.co/t/accessing-multi-fields/9544/3 "2012-11-04T03:27:37Z")

</div>

Answered on  
stackoverflow: [elasticsearch - How to reference multi-field when building query - Stack Overflow](http://stackoverflow.com/questions/13215435/elasticsearch-how-to-reference-multi-field-when-building-query)

On Saturday, November 3, 2012 9:56:30 PM UTC-4, Kennedy Idialu wrote:

> When I say it doesn't work, I mean, it returns 0 hits.
> 
> On Sunday, 4 November 2012 02:52:17 UTC+1, Kennedy Idialu wrote:
> 
> > I am unable to access multi fields using the navigation notation.
> > 
> > My mapping
> > 
> > {  
> > "mappings":{  
> > "document":{  
> > "properties":{  
> > "tags":{  
> > "type":"object",  
> > "properties":{  
> > "title":{  
> > "fields":{  
> > "partial":{  
> > "search\_analyzer":"main",  
> > "index\_analyzer":"partial",  
> > "type":"string"  
> > },  
> > "title":{  
> > "type":"string",  
> > "analyzer":"main"  
> > },  
> > "title2":{  
> > "type":"string",  
> > "analyzer":"main"  
> > }  
> > },  
> > "type":"multi\_field"  
> > }  
> > }  
> > }  
> > }  
> > }  
> > },
> > 
> > ```
> > "settings":{
> > "analysis":{
> > "filter":{
> > "name_ngrams":{
> > "side":"front",
> > "max_gram":50,
> > "min_gram":2,
> > "type":"edgeNGram"
> > },
> > "name_ngrams_back":{
> > "side":"back",
> > "max_gram":50,
> > "min_gram":2,
> > "type":"edgeNGram"
> > },
> > "name_middle_ngrams":{
> > "type":"nGram",
> > "max_gram":50,
> > "min_gram":2
> > }
> > },
> > 
> > "analyzer":{
> > "main":{
> > "filter": ["standard", "lowercase", "asciifolding"],
> > "type": "custom",
> > "tokenizer": "standard"
> > },
> > "partial":{
> > 
> > ```
> > 
> > "filter":["standard","lowercase","asciifolding","name\_ngrams"],  
> > "type": "custom",  
> > "tokenizer": "standard"  
> > }  
> > }  
> > }  
> > }
> > 
> > }
> > 
> > Test data
> > 
> > curl -XPUT localhost:9200/testindex/document/1 -d '{"title": "Fight for  
> > your life"}'  
> > curl -XPUT localhost:9200/testindex/document/2 -d '{"title": "Fighting  
> > for your life"}'  
> > curl -XPUT localhost:9200/testindex/document/3 -d '{"title": "Will you  
> > just start the fight"}'
> > 
> > Search
> > 
> > curl -XGET  
> > 'localhost:9200/testindex/document/\_search?q=title:life&pretty=1'  
> > // Ok  
> > curl -XGET  
> > 'localhost:9200/testindex/document/\_search?q=document.title:life&pretty=1'  
> > // Ok
> > 
> > // Doesn't work. I expect this to return same result as the first query.  
> > curl -XGET 'localhost:9200/testindex/document/\_search?q=_title.title2_  
> > :life&pretty=1'  
> > curl -XGET 'localhost:9200/testindex/document/\_search?q=\*  
> > document.title.title2\*:life&pretty=1'
> > 
> > My question is, how do I reference multi fields field when querying?
> > 
> > Thanks

--

---

<div class="post-metadata">

**Author:** ![Kennedy\_Idialu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kennedy_idialu/32/2532_2.png) [@Kennedy\_Idialu](https://discuss.elastic.co/u/Kennedy_Idialu)\
**Post date:** [November 4, 2012, 3:41am UTC](https://discuss.elastic.co/t/accessing-multi-fields/9544/4 "2012-11-04T03:41:28Z")

</div>

Thanks

On Sunday, 4 November 2012 04:27:38 UTC+1, Igor Motov wrote:

> Answered on stackoverflow:  
> [elasticsearch - How to reference multi-field when building query - Stack Overflow](http://stackoverflow.com/questions/13215435/elasticsearch-how-to-reference-multi-field-when-building-query)
> 
> On Saturday, November 3, 2012 9:56:30 PM UTC-4, Kennedy Idialu wrote:
> 
> > When I say it doesn't work, I mean, it returns 0 hits.
> > 
> > On Sunday, 4 November 2012 02:52:17 UTC+1, Kennedy Idialu wrote:
> > 
> > > I am unable to access multi fields using the navigation notation.
> > > 
> > > My mapping
> > > 
> > > {  
> > > "mappings":{  
> > > "document":{  
> > > "properties":{  
> > > "tags":{  
> > > "type":"object",  
> > > "properties":{  
> > > "title":{  
> > > "fields":{  
> > > "partial":{  
> > > "search\_analyzer":"main",  
> > > "index\_analyzer":"partial",  
> > > "type":"string"  
> > > },  
> > > "title":{  
> > > "type":"string",  
> > > "analyzer":"main"  
> > > },  
> > > "title2":{  
> > > "type":"string",  
> > > "analyzer":"main"  
> > > }  
> > > },  
> > > "type":"multi\_field"  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }  
> > > },
> > > 
> > > ```
> > > "settings":{
> > > "analysis":{
> > > "filter":{
> > > "name_ngrams":{
> > > "side":"front",
> > > "max_gram":50,
> > > "min_gram":2,
> > > "type":"edgeNGram"
> > > },
> > > "name_ngrams_back":{
> > > "side":"back",
> > > "max_gram":50,
> > > "min_gram":2,
> > > "type":"edgeNGram"
> > > },
> > > "name_middle_ngrams":{
> > > "type":"nGram",
> > > "max_gram":50,
> > > "min_gram":2
> > > }
> > > },
> > > 
> > > "analyzer":{
> > > "main":{
> > > "filter": ["standard", "lowercase", "asciifolding"],
> > > "type": "custom",
> > > "tokenizer": "standard"
> > > },
> > > "partial":{
> > > 
> > > ```
> > > 
> > > "filter":["standard","lowercase","asciifolding","name\_ngrams"],  
> > > "type": "custom",  
> > > "tokenizer": "standard"  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > }
> > > 
> > > Test data
> > > 
> > > curl -XPUT localhost:9200/testindex/document/1 -d '{"title": "Fight for  
> > > your life"}'  
> > > curl -XPUT localhost:9200/testindex/document/2 -d '{"title": "Fighting  
> > > for your life"}'  
> > > curl -XPUT localhost:9200/testindex/document/3 -d '{"title": "Will you  
> > > just start the fight"}'
> > > 
> > > Search
> > > 
> > > curl -XGET  
> > > 'localhost:9200/testindex/document/\_search?q=title:life&pretty=1'  
> > > // Ok  
> > > curl -XGET  
> > > 'localhost:9200/testindex/document/\_search?q=document.title:life&pretty=1'  
> > > // Ok
> > > 
> > > // Doesn't work. I expect this to return same result as the first  
> > > query.  
> > > curl -XGET 'localhost:9200/testindex/document/\_search?q=_title.title2_  
> > > :life&pretty=1'  
> > > curl -XGET 'localhost:9200/testindex/document/\_search?q=\*  
> > > document.title.title2\*:life&pretty=1'
> > > 
> > > My question is, how do I reference multi fields field when querying?
> > > 
> > > Thanks

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:06am UTC](https://discuss.elastic.co/t/accessing-multi-fields/9544/5 "2017-07-06T03:06:18Z")

</div>


